From 72b948fb1eaba1fc06de7325cc095f0889ce4d7f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 19 Jan 2013 11:51:56 +0100 Subject: allow to be typed; aborts last typed char * CTRL/C will be a command so it is important to be able to type it directly * aborting character processing is important because it allows aborting infinite loops * since the loop interruption currently relies on SIGINT handling, there is only limited support for XCurses and GTK - CTRL/C has to be typed in the terminal window. later support for input queue polling might be added --- src/interface-ncurses.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/interface-ncurses.cpp') diff --git a/src/interface-ncurses.cpp b/src/interface-ncurses.cpp index 97c050d..98f2dca 100644 --- a/src/interface-ncurses.cpp +++ b/src/interface-ncurses.cpp @@ -43,7 +43,7 @@ InterfaceNCurses interface; extern "C" { static void scintilla_notify(Scintilla *sci, int idFrom, - void *notify, void *user_data); + void *notify, void *user_data); } #define UNNAMED_FILE "(Unnamed)" @@ -63,7 +63,6 @@ static void scintilla_notify(Scintilla *sci, int idFrom, InterfaceNCurses::InterfaceNCurses() { init_screen(); - raw(); cbreak(); noecho(); curs_set(0); /* Scintilla draws its own cursor */ @@ -368,7 +367,12 @@ InterfaceNCurses::event_loop(void) if (popup.window) wrefresh(popup.window); + /* no special handling */ + raw(); key = wgetch(cmdline_window); + /* allow asynchronous interruptions on */ + cbreak(); + switch (key) { #ifdef KEY_RESIZE case ERR: @@ -403,6 +407,8 @@ InterfaceNCurses::event_loop(void) if (key <= 0xFF) cmdline_keypress((gchar)key); } + + sigint_occurred = FALSE; } } -- cgit v1.2.3