aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/.browser.lua2
-rw-r--r--core/events.lua8
-rw-r--r--core/ext/menu.lua16
3 files changed, 18 insertions, 8 deletions
diff --git a/core/.browser.lua b/core/.browser.lua
index a9ba1272..a9bb2ac1 100644
--- a/core/.browser.lua
+++ b/core/.browser.lua
@@ -63,7 +63,7 @@ function get_context_menu(selected_item)
-- @param menu_id The numeric ID of the menu item.
-- @param selected_item Identical to 'full_path' in pm.get_contents_for.
-- @see pm.get_contents_for
-function perform_menu_action(menu_item, selected_item)
+function perform_menu_action(menu_id, selected_item)
---
-- Toggles the width of the project manager.
diff --git a/core/events.lua b/core/events.lua
index fec8d4b9..8a2f86b8 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -65,8 +65,7 @@ module('textadept.events', package.seeall)
-- shift: flag indicating whether or not shift is pressed.
-- control: flag indicating whether or not control is pressed.
-- alt: flag indicating whether or not alt is pressed.
--- menu_clicked(menu_item, menu_id)
--- menu_item: text of the menu item clicked.
+-- menu_clicked(menu_id)
-- menu_id: the numeric ID of the menu item.
local events = textadept.events
@@ -138,9 +137,8 @@ end
function keypress(code, shift, control, alt)
return handle('keypress', code, shift, control, alt)
end
-function menu_clicked(menu_item)
- local text, menu_id = menu_item:match('^(.+)|(%d+)$')
- return handle('menu_clicked', text, tonumber(menu_id))
+function menu_clicked(menu_id_str)
+ return handle('menu_clicked', tonumber(menu_id_str))
end
-- Scintilla notifications.
diff --git a/core/ext/menu.lua b/core/ext/menu.lua
index 9124f748..cc1ae5c6 100644
--- a/core/ext/menu.lua
+++ b/core/ext/menu.lua
@@ -559,12 +559,24 @@ local actions = {
[ID.SHOW_PM_MODULES] = { pm_activate, 'modules' },
}
+-- lexers here MUST be in the same order as in the menu
+local lexers = {
+ 'actionscript', 'ada', 'antlr', 'apdl', 'applescript', 'asp', 'awk', 'batch',
+ 'boo', 'container', 'cpp', 'csharp', 'css', 'd', 'diff', 'django', 'eiffel',
+ 'erlang', 'errorlist', 'forth', 'fortran', 'gap', 'gettext', 'gnuplot',
+ 'groovy', 'haskell', 'html', 'idl', 'ini', 'io', 'java', 'javascript',
+ 'latex', 'lisp', 'lua', 'makefile', 'mysql', 'objective__c', 'ocaml',
+ 'pascal', 'perl', 'php', 'pike', 'postscript', 'props', 'python', 'r',
+ 'ragel', 'rebol', 'rexx', 'rhtml', 'ruby', 'scheme', 'shellscript',
+ 'smalltalk', 'tcl', 'vala', 'verilog', 'vhdl', 'visualbasic', 'xml'
+}
+
-- Most of this handling code comes from keys.lua.
t.events.add_handler('menu_clicked',
- function(menu_item, menu_id)
+ function(menu_id)
local active_table = actions[menu_id]
if menu_id >= ID.LEXER_ACTIONSCRIPT and menu_id <= ID.LEXER_XML then
- active_table = { set_lexer_language, menu_item }
+ active_table = { set_lexer_language, lexers[menu_id - 800] }
end
local f, args
if active_table and #active_table > 0 then