Zerobrane to scan or collapse the functions

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
oscaradalid
Prole
Posts: 12
Joined: Wed May 09, 2018 11:48 am

Zerobrane to scan or collapse the functions

Post by oscaradalid »

Good morning
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,
}


Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], thelinx and 5 guests