Skip to content

Commit

Permalink
emit focus_lost event
Browse files Browse the repository at this point in the history
  • Loading branch information
brainrake committed Nov 14, 2020
1 parent 53631f9 commit 979e069
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ end)

-- Set event constants.
for _, v in pairs(_SCINTILLA.events) do M[v[1]:upper()] = v[1] end
local textadept_events = {'appleevent_odoc','buffer_after_switch','buffer_before_switch','buffer_deleted','buffer_new','csi','command_text_changed','error','find','find_text_changed','focus','initialized','keypress','menu_clicked','mouse','quit','replace','replace_all','reset_after','reset_before','resume','suspend', 'tab_clicked','view_after_switch','view_before_switch','view_new'}
local textadept_events = {'appleevent_odoc','buffer_after_switch','buffer_before_switch','buffer_deleted','buffer_new','csi','command_text_changed','error','find','find_text_changed','focus','focus_lost','initialized','keypress','menu_clicked','mouse','quit','replace','replace_all','reset_after','reset_before','resume','suspend','tab_clicked','view_after_switch','view_before_switch','view_new'}
for _, v in pairs(textadept_events) do M[v:upper()] = v end

return M
1 change: 1 addition & 0 deletions src/textadept.c
Original file line number Diff line number Diff line change
Expand Up @@ -2285,6 +2285,7 @@ static GtkWidget *new_findbox() {
*/
static bool focus_lost(GtkWidget *widget, GdkEvent *_, void *L) {
if (widget == window && command_entry_focused) return true; // halt
emit(lua, "focus_lost", -1);
if (widget != command_entry || closing) return false;
return (emit(L, "keypress", LUA_TNUMBER, GDK_KEY_Escape, -1), false);
}
Expand Down

0 comments on commit 979e069

Please sign in to comment.