From 3706112c6bff358f1467afced9ff29d8a3246eb2 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 22 Dec 2021 20:41:31 +0100 Subject: Curses: added teco_interface_is_interrupted() fallback and standardized how to detect interactive/batch mode * Adds support for CTRL+C interruptions on Curses variants like PDCurses/GUI and XCurses. This also affects the current Win32 nightly builds which should now support CTRL+C interruptions. * The fallback is of course less efficient than the existing platform optimizations (existing for UNIX and Win32 console builds) and slows down parsing in interactive mode. * Use teco_interface.cmdline_window consistently to detect interactive mode. This may theoretically speed up SciTECO code execution slightly on shutdown. --- src/interface-gtk/interface.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/interface-gtk/interface.c') diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 104bb89..c32d2e3 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -713,6 +713,12 @@ teco_interface_popup_clear(void) * system call overhead. * But the GDK lock that would be necessary for synchronization * has been deprecated. + * + * @todo It would be great to have platform-specific optimizations, + * so we can detect interruptions without having to drive the Glib + * event loop (e.g. using libX11 or Win32 APIs). + * On the downside, such solutions will probably freeze the window + * while SciTECO is busy. */ gboolean teco_interface_is_interrupted(void) @@ -1095,6 +1101,10 @@ teco_interface_cleanup(void) * Called when the commandline widget is resized. * This should ensure that the caret jumps to the middle of the command line, * imitating the behaviour of the current Curses command line. + * + * @bug This no longer works when the command-line gets very long + * and the caret will eventually be stuck at the right edge. + * There seems to be an internal limit. */ static void teco_interface_cmdline_size_allocate_cb(GtkWidget *widget, -- cgit v1.2.3