Someone can provide me with a code that allows Zerobrane to scan or collapse the functions when I press a certain key. I find it quite useful, but I can't do it.
Code: Select all
local function hasBit(x, p)
return x % (p + p) >= p
end
package {
onEditorKeyDown = function(self, editor, event)
local keyCode = event:GetKeyCode()
if keyCode == 346 then -- tecla para contraer (ejemplo: F7)
local line = editor:LineFromPosition(editor:GetCurrentPos())
local level = editor:GetFoldLevel(line)
if hasBit(level, wxstc.wxSTC_FOLDLEVELHEADERFLAG) then
editor:ToggleFold(line)
end
elseif keyCode == 347 then -- tecla para expandir (ejemplo: F8)
local line = editor:LineFromPosition(editor:GetCurrentPos())
local level = editor:GetFoldLevel(line)
if hasBit(level, wxstc.wxSTC_FOLDLEVELHEADERFLAG) then
editor:ToggleFold(line)
end
end
end,
}