forked from pkulchenko/ZeroBranePackage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
closetabsleftright.lua
28 lines (26 loc) · 1019 Bytes
/
closetabsleftright.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
return {
name = "Close tabs left and right",
description = "Closes editor tabs to the left and to the right of the current one.",
author = "Paul Kulchenko",
version = 0.12,
dependencies = "1.60",
onMenuEditorTab = function(self, menu, notebook, event, index)
local idleft = ID(self.fname..".left")
local idright = ID(self.fname..".right")
menu:AppendSeparator()
menu:Append(idleft, "Close All on Left")
menu:Append(idright, "Close All on Right")
menu:Enable(idleft, index > 0)
menu:Enable(idright, index < notebook:GetPageCount()-1)
notebook:Connect(idleft, wx.wxEVT_COMMAND_MENU_SELECTED, function()
for _ = 0, index-1 do
if not ide:GetDocument(notebook:GetPage(0)):Close() then break end
end
end)
notebook:Connect(idright, wx.wxEVT_COMMAND_MENU_SELECTED, function()
for _ = index+1, notebook:GetPageCount()-1 do
if not ide:GetDocument(notebook:GetPage(index+1)):Close() then break end
end
end)
end,
}