|
沙发
楼主 |
发表于 2023-1-17 21:26:11
|
只看该作者
沙发 心灵亮光说: --删除光标所在句
if node.isEditable() then
local txt,s=node.text,""
local gb=node.getTextSelectionEnd()
local n1,n2=0,-1
if txt and txt~="" then
local tbl={",","。",":","?","!","……",";",",",".","!","?",";","\n",}
for n=gb-1,1,-1 do
if table.find(tbl,utf8.sub(txt,n,n)) then
n1=n
break
end
end
if gb<utf8.len(txt) then
for n=gb,utf8.len(txt)-1,1 do
if table.find(tbl,utf8.sub(txt,n,n)) then
n2=n
break
end
end
end
s=utf8.sub(txt,n1+1,n2)
txt=n2==-1 and utf8.sub(txt,1,n1) or utf8.sub(txt,1,n1)..utf8.sub(txt,n2+1,-1)
service.setText(node,txt)
service.setSelection(node,n1)
service.speak(s.."已删除")
else
service.speak("编辑框为空")
end
return true
end
本楼来自 天坦百宝箱 |
|