From 5b292b2408f24479b8ce5eb4d8a295a559bf8481 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 20 Jun 2014 12:02:35 -0400 Subject: Added `event.FOCUS` for when Textadept's window receives focus. --- core/events.lua | 5 ++++- core/file_io.lua | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'core') 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. -- cgit v1.2.3