diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/textadept/adeptsense.lua | 1 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 6 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 27 | ||||
-rw-r--r-- | modules/textadept/run.lua | 10 |
4 files changed, 20 insertions, 24 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua index 6d58ff41..55c0effc 100644 --- a/modules/textadept/adeptsense.lua +++ b/modules/textadept/adeptsense.lua @@ -661,6 +661,7 @@ function M.get_apidoc(sense, symbol) end local apidocs = nil + --- -- Shows a call tip with API documentation for the symbol behind the caret. -- If documentation is already being shown, cycles through multiple definitions. diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index baaa09ff..896d4b0d 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -86,12 +86,6 @@ M.braces = {[40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1} -- @see TYPEOVER_CHARS M.typeover_chars = {[41] = 1, [93] = 1, [125] = 1, [39] = 1, [34] = 1} --- The current call tip. --- Used for displaying call tips. --- @class table --- @name current_call_tip -local current_call_tip = {} - -- Matches characters specified in char_matches. events.connect(events.CHAR_ADDED, function(c) if not M.AUTOPAIR then return end diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index 67436b1d..7f945a9e 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -11,19 +11,6 @@ local M = {} -- menus. module('_M.textadept.menu')]] --- Get a string uniquely identifying a key binding. --- This is used to match menu items with key bindings to show the key shortcut. --- @param f A value in the `keys` table. -local function get_id(f) - local id = '' - if type(f) == 'function' then - id = tostring(f) - elseif type(f) == 'table' then - for _, v in ipairs(f) do id = id..tostring(v) end - end - return id -end - local _L, _M, buffer, view = _L, _M, buffer, view local m_editing, utils = _M.textadept.editing, _M.textadept.keys.utils local SEPARATOR, c = {''}, _SCINTILLA.constants @@ -246,6 +233,19 @@ local function get_gdk_key(key_seq) return byte, modifiers end +-- Get a string uniquely identifying a key binding. +-- This is used to match menu items with key bindings to show the key shortcut. +-- @param f A value in the `keys` table. +local function get_id(f) + local id = '' + if type(f) == 'function' then + id = tostring(f) + elseif type(f) == 'table' then + for i = 1, #f do id = id..tostring(f[i]) end + end + return id +end + local key_shortcuts, menu_actions, contextmenu_actions -- Creates a menu suitable for `gui.menu()` from the menu table format. @@ -348,6 +348,7 @@ function M.select_command() if i then keys.run_command(commands[i + 1], type(commands[i + 1])) end end +-- Performs the appropriate action when clicking a menu item. events.connect(events.MENU_CLICKED, function(menu_id) local actions = menu_id < 1000 and menu_actions or contextmenu_actions local action = actions[menu_id < 1000 and menu_id or menu_id - 1000] diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index 91c8a522..18577448 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -38,7 +38,6 @@ module('_M.textadept.run')]] M.MARK_ERROR_BACK = not CURSES and 0x8080CC or 0x0000FF -- Events. -local events, events_connect, events_emit = events, events.connect, events.emit events.COMPILE_OUTPUT, events.RUN_OUTPUT = 'compile_output', 'run_output' local preferred_view @@ -71,6 +70,7 @@ local function command(cmd_table, compiling) local current_dir = lfs.currentdir() lfs.chdir(filedir) local event = compiling and events.COMPILE_OUTPUT or events.RUN_OUTPUT + local events_emit = events.emit local lexer = buffer:get_lexer() events_emit(event, lexer, '> '..command:iconv('UTF-8', _CHARSET)) local p = io.popen(command..' 2>&1') @@ -138,7 +138,7 @@ M.compile_command = {} -- @see _G.events -- @name compile function M.compile() command(M.compile_command, true) end -events_connect(events.COMPILE_OUTPUT, print_output) +events.connect(events.COMPILE_OUTPUT, print_output) --- -- Map of file extensions (excluding the leading '.') to their associated @@ -165,7 +165,7 @@ M.run_command = {} -- @see _G.events -- @name run function M.run() command(M.run_command) end -events_connect(events.RUN_OUTPUT, print_output) +events.connect(events.RUN_OUTPUT, print_output) --- -- Map of lexer names to their error string details, tables containing the @@ -240,7 +240,7 @@ function M.goto_error(line, next) buffer.annotation_style[line - 1] = 8 -- error end end -events_connect(events.DOUBLE_CLICK, function(pos, line) M.goto_error(line) end) +events.connect(events.DOUBLE_CLICK, function(pos, line) M.goto_error(line) end) local CURSES_MARK = _SCINTILLA.constants.SC_MARK_CHARACTER + string.byte(' ') -- Sets view properties for error markers. @@ -249,6 +249,6 @@ local function set_error_properties() buffer.marker_back[MARK_ERROR] = M.MARK_ERROR_BACK end if buffer then set_error_properties() end -events_connect(events.VIEW_NEW, set_error_properties) +events.connect(events.VIEW_NEW, set_error_properties) return M |