insert ;{ ;} why not folding

Get help with using AutoHotkey and its commands and hotkeys
cgx5871
Posts: 10
Joined: 26 Jul 2018, 14:02

insert ;{ ;} why not folding

01 Aug 2018, 09:39

-------Scite4AHK----- !z = Selection insert ";{" + ";}" and folding
---- -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?
Last edited by cgx5871 on 01 Aug 2018, 11:06, edited 2 times in total.
gregster
Posts: 2966
Joined: 30 Sep 2013, 06:48

Re: insert ;{ ;} why not folding

01 Aug 2018, 10:40

This isn't an Autohotkey script. So, what is this for? For use in a specific AHK editor?
cgx5871
Posts: 10
Joined: 26 Jul 2018, 14:02

Re: insert ;{ ;} why not folding

01 Aug 2018, 10:58

gregster wrote:This isn't an Autohotkey script. So, what is this for? For use in a specific AHK editor?

-----Scite4AHK----- !z = Selection insert ";{" + ";}" and folding
command.shortcut.35.*=Alt+z
command.35.*=CommentFold

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Xtra and 282 guests