aboutsummaryrefslogtreecommitdiff
path: root/core/ext/menu.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2008-07-23 01:44:23 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2008-07-23 01:44:23 -0400
commit74901ad5584c2875987144071778a84fd9b2b066 (patch)
tree0a9e319cdb40f883ab527c3c70e934ac4e33cb97 /core/ext/menu.lua
parent70eda368e796d227cea060fc533a3b10e52edb8d (diff)
downloadtextadept-74901ad5584c2875987144071778a84fd9b2b066.tar.gz
textadept-74901ad5584c2875987144071778a84fd9b2b066.zip
Can change lexer via the menu in core/ext/menu.lua.
Diffstat (limited to 'core/ext/menu.lua')
-rw-r--r--core/ext/menu.lua27
1 files changed, 22 insertions, 5 deletions
diff --git a/core/ext/menu.lua b/core/ext/menu.lua
index dd2b986d..44e55da5 100644
--- a/core/ext/menu.lua
+++ b/core/ext/menu.lua
@@ -146,6 +146,17 @@ t.menubar = {
'Show PM _Macros',
'Show PM Mo_dules',
},
+ gtkmenu {
+ title = '_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',
+ 'pascal', 'php', 'pike', 'postscript', 'props', 'python', 'r', 'ragel',
+ 'rebol', 'rhtml', 'ruby', 'scheme', 'shellscript', 'smalltalk', 'tcl',
+ 'vala', 'verilog', 'vhdl', 'visualbasic', 'xml',
+ },
}
local b, v = 'buffer', 'view'
@@ -163,6 +174,10 @@ local function toggle_setting(setting)
end
t.events.update_ui() -- for updating statusbar
end
+local function set_lexer_language(lexer)
+ buffer:set_lexer_language(lexer)
+ buffer:colourise(0, -1)
+end
local actions = {
-- File
@@ -175,7 +190,7 @@ local actions = {
['Close All'] = { t.io.close_all },
['Load Session...'] = { t.io.load_session }, -- TODO: file open dialog prompt
['Save Session...'] = { t.io.save_session }, -- TODO: file save dialog prompt
- -- TODO: Quit
+ Quit = { }, -- TODO:
-- Edit
Undo = { 'undo', b },
Redo = { 'redo', b },
@@ -229,9 +244,10 @@ local actions = {
Scope = { m_editing.select_scope },
-- Search
Find = { t.find.focus },
- -- TODO: Find Next
- -- TODO: Find Prev
- -- TODO: Replace
+ ['Find Next'] = { }, -- TODO:
+ ['Find Prev'] = { }, -- TODO:
+ Replace = { }, -- TODO:
+ ['Find and Replace'] = { }, -- TODO:
['Jump to'] = { m_editing.goto_line },
-- Tools
['Focus Command Entry'] = { t.command_entry.focus },
@@ -279,7 +295,8 @@ local actions = {
-- Most of this handling code comes from keys.lua.
t.events.add_handler('menu_clicked',
function(menu_item)
- local active_table = actions[menu_item]
+ local active_table = actions[menu_item] or
+ { set_lexer_language, menu_item } -- anything not in actions is a lexer
local f, args
if active_table and #active_table > 0 then
local func = active_table[1]