From fb0b2158e31f9aab45512413565e133e60b1d7f8 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 3 Sep 2014 20:45:29 +0200 Subject: [PATCH] window: enable nonl and use raw terminal mode --- src/ncmpcpp.cpp | 2 ++ src/window.cpp | 4 +++- src/window.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index f821b022..7c4d2180 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -152,6 +152,8 @@ int main(int argc, char **argv) # ifndef WIN32 signal(SIGPIPE, sighandler); signal(SIGWINCH, sighandler); + // ignore Ctrl-C + sigignore(SIGINT); # endif // !WIN32 while (!Actions::ExitMainLoop) diff --git a/src/window.cpp b/src/window.cpp index 15877c14..01d0ab8b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -375,10 +375,12 @@ void initScreen(GNUC_UNUSED const char *window_title, bool enable_colors) for (int j = 0; j < 8; ++j) init_pair(num++, ColorsTable[j], i < 0 ? i : ColorsTable[i]); } + raw(); + nonl(); noecho(); - cbreak(); curs_set(0); + rl_catch_signals = 0; rl_initialize(); // disable autocompletion rl_bind_key('\t', nullptr); diff --git a/src/window.h b/src/window.h index 144b9e9e..29430265 100644 --- a/src/window.h +++ b/src/window.h @@ -89,7 +89,7 @@ // KEY_ENTER is 343, which doesn't make any sense. This makes it useful. #undef KEY_ENTER -#define KEY_ENTER 10 +#define KEY_ENTER 13 // undefine scroll macro as it collides with Window::scroll #undef scroll