From fc0efcc89825ef1f61ffe5744b58f7d4e16c2aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 22 Mar 2017 19:53:22 +0100 Subject: ui: try to fix job control issues with certain shells Make sure that curses and libtermkey don't fight over the terminal state. Also send use SIGTSTP instead of SIGSTOP. Previously certain shells (e.g. csh, dash) would get stuck after the editor process was suspended for the second time. Not completely sure whether this is correct, but it seems to work in my limited tests. --- ui-terminal-vt100.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ui-terminal-vt100.c') diff --git a/ui-terminal-vt100.c b/ui-terminal-vt100.c index 309261a..b584276 100644 --- a/ui-terminal-vt100.c +++ b/ui-terminal-vt100.c @@ -39,6 +39,8 @@ #include #include "buffer.h" +#define UI_TERMKEY_FLAGS TERMKEY_FLAG_UTF8 + #define ui_term_backend_init ui_vt100_init #define ui_term_backend_blit ui_vt100_blit #define ui_term_backend_clear ui_vt100_clear @@ -92,7 +94,7 @@ static void output_literal(const char *data) { } static void screen_alternate(bool alternate) { - output_literal(alternate ? "\x1b[?1049h" : "\x1b[0m" "\x1b[?1049l"); + output_literal(alternate ? "\x1b[?1049h" : "\x1b[0m" "\x1b[?1049l" "\x1b[0m" ); } static void cursor_visible(bool visible) { @@ -183,14 +185,16 @@ static int ui_vt100_colors(Ui *ui) { return (term && strstr(term, "-256color")) ? 256 : 16; } -static void ui_vt100_suspend(UiTerm *term) { +static void ui_vt100_suspend(UiTerm *tui) { + termkey_stop(tui->termkey); cursor_visible(true); screen_alternate(false); } -static void ui_vt100_resume(UiTerm *term) { +static void ui_vt100_resume(UiTerm *tui) { screen_alternate(true); cursor_visible(false); + termkey_start(tui->termkey); } static bool ui_vt100_init(UiTerm *tui, char *term) { -- cgit v1.2.3