diff options
-rw-r--r-- | src/textadept.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/textadept.c b/src/textadept.c index c51af911..da141388 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -134,7 +134,7 @@ static ListStore *find_history, *repl_history; #define set_option_label(o, _, l) gtk_button_set_label(GTK_BUTTON(o), l) #define find_active(w) gtk_widget_get_visible(w) // GTK command entry. -#define command_entry_focused gtk_widget_has_focus(command_entry) +#define command_entry_active gtk_widget_has_focus(command_entry) #elif CURSES // curses window. typedef struct Pane { @@ -180,7 +180,7 @@ static ListStore find_history[10], repl_history[10]; } while (false) #define find_active(w) (w != NULL) // Curses command entry and statusbar. -static bool command_entry_focused; +static bool command_entry_active; int statusbar_length[2]; #endif @@ -360,7 +360,7 @@ static void refresh_pane(Pane *pane) { /** Refreshes the entire screen. */ static void refresh_all() { refresh_pane(pane); - if (command_entry_focused) scintilla_noutrefresh(command_entry); + if (command_entry_active) scintilla_noutrefresh(command_entry); refresh(); } @@ -548,9 +548,9 @@ static int focus_command_entry(lua_State *L) { else gtk_widget_hide(command_entry), gtk_widget_grab_focus(focused_view); #elif CURSES - command_entry_focused = !command_entry_focused; - if (!command_entry_focused) SS(command_entry, SCI_SETFOCUS, 0, 0); - focus_view(command_entry_focused ? command_entry : focused_view); + command_entry_active = !command_entry_active; + if (!command_entry_active) SS(command_entry, SCI_SETFOCUS, 0, 0); + focus_view(command_entry_active ? command_entry : focused_view); #endif return 0; } @@ -1324,7 +1324,7 @@ static int buffer_index(lua_State *L) { #endif } else if (strcmp(lua_tostring(L, 2), "active") == 0 && lua_todoc(L, 1) == SS(command_entry, SCI_GETDOCPOINTER, 0, 0)) - lua_pushboolean(L, command_entry_focused); + lua_pushboolean(L, command_entry_active); else if (strcmp(lua_tostring(L, 2), "height") == 0 && lua_todoc(L, 1) == SS(command_entry, SCI_GETDOCPOINTER, 0, 0)) { // Return the command entry's pixel height. @@ -1643,7 +1643,7 @@ static bool init_lua(lua_State *L, int argc, char **argv, bool reinit) { #if GTK /** Signal for a Textadept window focus change. */ static bool window_focused(GtkWidget *_, GdkEventFocus *__, void *L) { - if (!command_entry_focused) emit(L, "focus", -1); + if (!command_entry_active) emit(L, "focus", -1); return false; } @@ -2282,7 +2282,7 @@ static GtkWidget *new_findbox() { * losing focus or the application is quitting. */ static bool focus_lost(GtkWidget *widget, GdkEvent *_, void *L) { - if (widget == window && command_entry_focused) return true; // halt + if (widget == window && command_entry_active) return true; // halt if (widget != command_entry || closing) return false; return (emit(L, "keypress", LUA_TNUMBER, GDK_KEY_Escape, -1), false); } @@ -2470,7 +2470,7 @@ static TermKeyResult textadept_waitkey(TermKey *tk, TermKeyKey *key) { } #else // TODO: ideally computation of view would not be done twice. - Scintilla *view = !command_entry_focused ? focused_view : command_entry; + Scintilla *view = !command_entry_active ? focused_view : command_entry; termkey_set_fd(ta_tk, scintilla_get_window(view)); mouse_set(ALL_MOUSE_EVENTS); // _popen() and system() change console mode return termkey_getkey(tk, key); @@ -2650,7 +2650,7 @@ int main(int argc, char **argv) { break; } refresh_all(); - view = !command_entry_focused ? focused_view : command_entry; + view = !command_entry_active ? focused_view : command_entry; } endwin(); termkey_destroy(ta_tk); |