diff options
-rw-r--r-- | core/events.lua | 5 | ||||
-rw-r--r-- | core/file_io.lua | 1 | ||||
-rw-r--r-- | src/textadept.c | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/core/events.lua b/core/events.lua index f4f520c5..a79be38b 100644 --- a/core/events.lua +++ b/core/events.lua @@ -118,6 +118,9 @@ local M = {} -- -- * _`text`_: The text to search for. -- * _`next`_: Whether or not to search forward. +-- @field FOCUS (string) +-- Emitted when Textadept receives focus. +-- This event is never emitted when Textadept is running in the terminal. -- @field HOTSPOT_CLICK (string) -- Emitted when clicking on text that is in a style that has the hotspot -- attribute set. @@ -376,7 +379,7 @@ for _, n in pairs(scnotifications) do M[n[1]:upper()] = n[1] end local ta_events = { 'appleevent_odoc', 'buffer_after_switch', 'buffer_before_switch', 'buffer_deleted', 'buffer_new', 'command_entry_command', - 'command_entry_keypress', 'error', 'find', 'initialized', 'keypress', + 'command_entry_keypress', 'error', 'find', 'focus', 'initialized', 'keypress', 'menu_clicked', 'quit', 'replace', 'replace_all', 'reset_after', 'reset_before', 'view_after_switch', 'view_before_switch', 'view_new' } diff --git a/core/file_io.lua b/core/file_io.lua index 7ddfee00..eb91ed2a 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -305,6 +305,7 @@ local function update_modified_file() end events_connect(events.BUFFER_AFTER_SWITCH, update_modified_file) events_connect(events.VIEW_AFTER_SWITCH, update_modified_file) +events_connect(events.FOCUS, update_modified_file) -- Prompts the user to reload the current file if it has been externally -- modified. diff --git a/src/textadept.c b/src/textadept.c index bbf86d98..31959e2c 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1687,7 +1687,7 @@ static int lL_init(lua_State *L, int argc, char **argv, int reinit) { static int w_focus(GtkWidget*_, GdkEventFocus*__, void*___) { if (focused_view && !gtk_widget_has_focus(focused_view)) gtk_widget_grab_focus(focused_view); - return FALSE; + return (lL_event(lua, "focus", -1), FALSE); } /** Signal for a Textadept keypress. */ |