aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2014-05-29 16:18:11 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2014-05-29 16:18:11 -0400
commitdd4b723d91443d79fb11961df0816fc6bdcdc593 (patch)
tree17e851ef415237a61fa4254974a3b37a8fbadd69
parent6811168fdcfb1e2d57a5d7e90292d037104f2281 (diff)
Fix bug when copying an existing menu/submenu; modules/textadept/menu.lua
-rw-r--r--modules/textadept/menu.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index b974c5db..a3da4092 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -334,10 +334,11 @@ local function proxy_menu(menu, update, menubar)
return type(v) == 'table' and proxy_menu(v, update, menubar or menu) or v
end,
__newindex = function(t, k, v)
- menu[k] = v
+ menu[k] = getmetatable(v) and getmetatable(v).menu or v
update(menubar or menu)
end,
__len = function(t) return #menu end,
+ menu = menu -- store existing menu for copying (e.g. m[#m + 1] = m[#m])
})
end