diff options
-rw-r--r-- | core/ext/mime_types.lua | 8 | ||||
-rw-r--r-- | core/ext/pm/buffer_browser.lua | 12 | ||||
-rw-r--r-- | core/ext/pm/ctags_browser.lua | 10 | ||||
-rw-r--r-- | core/ext/pm/macro_browser.lua | 6 | ||||
-rw-r--r-- | core/handlers.lua | 22 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 4 | ||||
-rw-r--r-- | modules/textadept/keys.lua | 2 | ||||
-rw-r--r-- | modules/textadept/macros.lua | 2 |
8 files changed, 33 insertions, 33 deletions
diff --git a/core/ext/mime_types.lua b/core/ext/mime_types.lua index 489f1d4a..ec4ef808 100644 --- a/core/ext/mime_types.lua +++ b/core/ext/mime_types.lua @@ -120,7 +120,7 @@ local function handle_switch() end local handlers = textadept.handlers -handlers.add_function_to_handler('file_opened', handle_new) -handlers.add_function_to_handler('file_saved_as', handle_new) -handlers.add_function_to_handler('buffer_switch', handle_switch) -handlers.add_function_to_handler('view_new', handle_switch) +handlers.add_handler_function('file_opened', handle_new) +handlers.add_handler_function('file_saved_as', handle_new) +handlers.add_handler_function('buffer_switch', handle_switch) +handlers.add_handler_function('view_new', handle_switch) diff --git a/core/ext/pm/buffer_browser.lua b/core/ext/pm/buffer_browser.lua index 56891fa9..1c2fb33c 100644 --- a/core/ext/pm/buffer_browser.lua +++ b/core/ext/pm/buffer_browser.lua @@ -46,12 +46,12 @@ function perform_menu_action(menu_item, selected_item) textadept.pm.activate() end -local add_function_to_handler = textadept.handlers.add_function_to_handler +local add_handler_function = textadept.handlers.add_handler_function local function update_view() if matches(textadept.pm.entry_text) then textadept.pm.activate() end end -add_function_to_handler('file_opened', update_view) -add_function_to_handler('buffer_new', update_view) -add_function_to_handler('buffer_deleted', update_view) -add_function_to_handler('save_point_reached', update_view) -add_function_to_handler('save_point_left', update_view) +add_handler_function('file_opened', update_view) +add_handler_function('buffer_new', update_view) +add_handler_function('buffer_deleted', update_view) +add_handler_function('save_point_reached', update_view) +add_handler_function('save_point_left', update_view) diff --git a/core/ext/pm/ctags_browser.lua b/core/ext/pm/ctags_browser.lua index 2d2385ad..842dce9e 100644 --- a/core/ext/pm/ctags_browser.lua +++ b/core/ext/pm/ctags_browser.lua @@ -230,7 +230,7 @@ function perform_menu_action(menu_item, selected_item) end -local add_function_to_handler = textadept.handlers.add_function_to_handler +local add_handler_function = textadept.handlers.add_handler_function local function update_view() if matches(textadept.pm.entry_text) then if buffer.filename then @@ -240,7 +240,7 @@ local function update_view() end end end -add_function_to_handler('file_opened', update_view) -add_function_to_handler('buffer_deleted', update_view) -add_function_to_handler('buffer_switch', update_view) -add_function_to_handler('save_point_reached', update_view) +add_handler_function('file_opened', update_view) +add_handler_function('buffer_deleted', update_view) +add_handler_function('buffer_switch', update_view) +add_handler_function('save_point_reached', update_view) diff --git a/core/ext/pm/macro_browser.lua b/core/ext/pm/macro_browser.lua index 237aa9fb..3fc38aca 100644 --- a/core/ext/pm/macro_browser.lua +++ b/core/ext/pm/macro_browser.lua @@ -35,9 +35,9 @@ function perform_menu_action(menu_item, selected_item) textadept.pm.activate() end -local add_function_to_handler = textadept.handlers.add_function_to_handler +local add_handler_function = textadept.handlers.add_handler_function local function update_view() if matches(textadept.pm.entry_text) then textadept.pm.activate() end end -add_function_to_handler('macro_saved', update_view) -add_function_to_handler('macro_deleted', update_view) +add_handler_function('macro_saved', update_view) +add_handler_function('macro_deleted', update_view) diff --git a/core/handlers.lua b/core/handlers.lua index ec916fce..e0a7a8e0 100644 --- a/core/handlers.lua +++ b/core/handlers.lua @@ -12,7 +12,7 @@ local handlers = textadept.handlers -- @param handler The string handler name. -- @param f The Lua function to add. -- @param index Optional index to insert the handler into. -function add_function_to_handler(handler, f, index) +function add_handler_function(handler, f, index) local plural = handler..'s' if not handlers[plural] then handlers[plural] = {} end local funcs = handlers[plural] @@ -134,7 +134,7 @@ end -- Default handlers to follow. -add_function_to_handler('char_added', +add_handler_function('char_added', function(char) -- auto-indent on return if char ~= '\n' then return end local buffer = buffer @@ -164,13 +164,13 @@ local function set_title(buffer) textadept.title = filename:match('[^/]+$')..d..'Textadept' end -add_function_to_handler('save_point_reached', +add_handler_function('save_point_reached', function() -- changes Textadept title to show 'clean' buffer buffer.dirty = false set_title(buffer) end) -add_function_to_handler('save_point_left', +add_handler_function('save_point_left', function() -- changes Textadept title to show 'dirty' buffer buffer.dirty = true set_title(buffer) @@ -203,7 +203,7 @@ local function match_brace(current_pos) return false end -add_function_to_handler('update_ui', +add_handler_function('update_ui', function() -- highlights matching braces local buffer = buffer if not match_brace(buffer.current_pos) then buffer:brace_bad_light(-1) end @@ -211,7 +211,7 @@ add_function_to_handler('update_ui', local docstatusbar_text = "Line: %d/%d Col: %d Lexer: %s %s %s %s" -add_function_to_handler('update_ui', +add_handler_function('update_ui', function() -- sets docstatusbar text local buffer = buffer local pos = buffer.current_pos @@ -225,14 +225,14 @@ add_function_to_handler('update_ui', docstatusbar_text:format(line, max, col, lexer, mode, eol, tabs) end) -add_function_to_handler('margin_click', +add_handler_function('margin_click', function(margin, modifiers, position) -- toggles folding local buffer = buffer local line = buffer:line_from_position(position) buffer:toggle_fold(line) end) -add_function_to_handler('buffer_new', +add_handler_function('buffer_new', function() -- set additional buffer functions local buffer, textadept = buffer, textadept buffer.save = textadept.io.save @@ -241,19 +241,19 @@ add_function_to_handler('buffer_new', set_title(buffer) end) -add_function_to_handler('buffer_switch', +add_handler_function('buffer_switch', function() -- updates titlebar and statusbar set_title(buffer) update_ui() end) -add_function_to_handler('view_switch', +add_handler_function('view_switch', function() -- updates titlebar and statusbar set_title(buffer) update_ui() end) -add_function_to_handler('quit', +add_handler_function('quit', function() -- prompts for confirmation if any buffers are dirty; saves session local any = false local list = 'The following buffers are unsaved:\n\n' diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 4af699ce..282d5ad3 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -55,7 +55,7 @@ local enclosure = { single_tag = { left = '<', right = ' />' } } -textadept.handlers.add_function_to_handler('char_added', +textadept.handlers.add_handler_function('char_added', function(c) -- matches characters specified in char_matches if char_matches[c] then buffer:insert_text( -1, char_matches[c] ) @@ -154,7 +154,7 @@ function show_call_tip(api, start) buffer:call_tip_show(current_call_tip.start_pos, call_tip) end -textadept.handlers.add_function_to_handler('call_tip_click', +textadept.handlers.add_handler_function('call_tip_click', function(position) -- display the next or previous call tip if not buffer:call_tip_active() then return end if position == 1 and current_call_tip.num > 1 then diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index 77a5cef7..f7131782 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -127,7 +127,7 @@ function keypress(code, shift, control, alt) else return true end end end -textadept.handlers.add_function_to_handler('keypress', keypress, 1) +textadept.handlers.add_handler_function('keypress', keypress, 1) -- Note the following functions are called inside pcall so error handling or -- checking if keys exist etc. is not necessary. diff --git a/modules/textadept/macros.lua b/modules/textadept/macros.lua index 0ba966c6..0d81f105 100644 --- a/modules/textadept/macros.lua +++ b/modules/textadept/macros.lua @@ -38,7 +38,7 @@ local function macro_notification(msg, wParam, lParam) textadept.statusbar_text = 'Macro recording' end end -textadept.handlers.add_function_to_handler('macro_record', macro_notification) +textadept.handlers.add_handler_function('macro_record', macro_notification) --- -- Starts recording a macro. |