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.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/interface.h') diff --git a/src/interface.h b/src/interface.h index 28be9fe..38cd725 100644 --- a/src/interface.h +++ b/src/interface.h @@ -19,6 +19,7 @@ #define __INTERFACE_H #include +#include #include @@ -29,6 +30,7 @@ /* avoid include dependency conflict */ class QRegister; class Buffer; +extern sig_atomic_t sigint_occurred; /* * Base class for all user interfaces - used mereley as a class interface. @@ -107,6 +109,12 @@ public: virtual void popup_show(void) = 0; virtual void popup_clear(void) = 0; + virtual inline bool + is_interrupted(void) + { + return sigint_occurred != FALSE; + } + /* main entry point */ virtual void event_loop(void) = 0; -- cgit v1.2.3