Last active
July 15, 2018 08:51
-
-
Save SpotlightKid/9964085 to your computer and use it in GitHub Desktop.
Lua script to select folding block in Geany editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Select block corresponding to current folding level | |
--]] | |
line, col = geany.rowcol() | |
-- Scintilla uses 0-based line numbering internally | |
line = line - 1 | |
--~print("L: " .. line .. " C: " .. col) | |
fstart = geany.scintilla("SCI_GETFOLDPARENT", line) | |
--~print("S: " .. fstart+1) | |
fend = geany.scintilla("SCI_GETLASTCHILD", line, -1) | |
--~print("E: " .. fend+1) | |
if fend == line then | |
fend = geany.scintilla("SCI_GETLASTCHILD", fstart, -1) | |
sstart = geany.rowcol(fstart + 1, 0) | |
send = geany.rowcol(fend + 2, 0) | |
else | |
sstart = geany.rowcol(line + 1, 0) | |
send = geany.rowcol(fend + 2, 0) | |
end | |
geany.select(send, sstart) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment