---- -Command --Lua
SciTEUser.properties:
command.shortcut.35.*=Alt+z
command.35.*=CommentFold
--------------Lua Code
Code: Select all
function CommentFold()
local p1=editor.SelectionStart
local p2=editor.SelectionEnd
local L=editor:LineFromPosition(editor.SelectionEnd)
if p1==p2 then
return
end
local Asc = {[0]=1,[9]=1,[10]=1,[13]=1,[32]=1,[34]=1,[39]=1,[44]=1}
while Asc[editor.CharAt[p1]] == nil do
p1 = p1 + 1
end
editor:InsertText(p1,"\t;{")
while Asc[editor.CharAt[p2]] == nil do
p2 = p2 + 1
end
editor:InsertText(p2,"\t;}")
scite.SendEditor(SCI_TOGGLEFOLD, L)
end
the first time not folding
but the second folding fit it
why?