From 68cc07022c27010e02acd69ffd832c97b8b9b9a4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 8 Nov 2012 14:04:41 +0100 Subject: [PATCH] NCurses: catch SIGINT and send a C-c instead --- src/ncurses.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ncurses.cc b/src/ncurses.cc index 1e601a3b..5c5509fb 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -89,6 +89,12 @@ void on_term_resize(int) EventManager::instance().force_signal(0); } +void on_sigint(int) +{ + ungetch(CTRL('c')); + EventManager::instance().force_signal(0); +} + NCursesUI::NCursesUI() { //setlocale(LC_CTYPE, ""); @@ -111,6 +117,7 @@ NCursesUI::NCursesUI() assert(signal_ui == nullptr); signal_ui = this; signal(SIGWINCH, on_term_resize); + signal(SIGINT, on_sigint); } NCursesUI::~NCursesUI()