From 22ff86dc902db37bff2d6d0cc330403506c7b85e Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 4 Oct 2012 17:11:15 -0400 Subject: Flush input queue in ncurses when finished with CDK widgets; src/textadept.c Otherwise, if 'Esc' is pressed twice rapidly, it is stored in the queue. --- src/textadept.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/textadept.c b/src/textadept.c index fcc6eb54..618dedce 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -62,6 +62,7 @@ typedef GtkWidget Scintilla; #define SS(view, m, w, l) scintilla_send_message(view, m, w, l) #define focus_view(v) \ SS(focused_view, SCI_SETFOCUS, 0, 0), SS(v, SCI_SETFOCUS, 1, 0) +#define flushch() timeout(0), getch(), timeout(-1) static struct termios term; #endif @@ -431,7 +432,7 @@ static int lfind_focus(lua_State *L) { free(clipboard), free(GPasteBuffer), GPasteBuffer = NULL; destroyCDKEntry(find_entry), destroyCDKEntry(replace_entry); destroyCDKButtonbox(buttonbox), destroyCDKButtonbox(optionbox); - delwin(findbox->window), destroyCDKScreen(findbox), findbox = NULL; + delwin(findbox->window), destroyCDKScreen(findbox), findbox = NULL, flushch(); wresize(scintilla_get_window(focused_view), LINES - 2, COLS); #endif return 0; @@ -585,7 +586,7 @@ static int lce_focus(lua_State *L) { if (strcmp(clipboard, GPasteBuffer)) set_clipboard(GPasteBuffer); free(clipboard), free(GPasteBuffer), GPasteBuffer = NULL; destroyCDKEntry(command_entry), command_entry = NULL; - delwin(screen->window), destroyCDKScreen(screen); + delwin(screen->window), destroyCDKScreen(screen), flushch(); #endif return 0; } @@ -639,7 +640,7 @@ static int lce_show_completions(lua_State *L) { } curs_set(1); destroyCDKScroll(scrolled); - delwin(screen->window), destroyCDKScreen(screen); + delwin(screen->window), destroyCDKScreen(screen), flushch(); free(items); drawCDKEntry(command_entry, FALSE); #endif -- cgit v1.2.3