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.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'ui-terminal.c') diff --git a/ui-terminal.c b/ui-terminal.c index 4b4a60b..e790785 100644 --- a/ui-terminal.c +++ b/ui-terminal.c @@ -563,7 +563,7 @@ static void ui_info_hide(Ui *ui) { } static TermKey *ui_termkey_new(int fd) { - TermKey *termkey = termkey_new(fd, TERMKEY_FLAG_UTF8); + TermKey *termkey = termkey_new(fd, UI_TERMKEY_FLAGS); if (termkey) termkey_set_canonflags(termkey, TERMKEY_CANON_DELBS); return termkey; @@ -589,13 +589,11 @@ static TermKey *ui_termkey_get(Ui *ui) { static void ui_suspend(Ui *ui) { UiTerm *tui = (UiTerm*)ui; ui_term_backend_suspend(tui); - termkey_stop(tui->termkey); - kill(0, SIGSTOP); + kill(0, SIGTSTP); } static void ui_resume(Ui *ui) { UiTerm *tui = (UiTerm*)ui; - termkey_start(tui->termkey); ui_term_backend_resume(tui); } @@ -650,7 +648,7 @@ static bool ui_init(Ui *ui, Vis *vis) { if (errno == EBADF && !isatty(STDIN_FILENO)) { errno = 0; if (!(tui->termkey = ui_termkey_reopen(ui, STDIN_FILENO)) && errno == ENXIO) - tui->termkey = termkey_new_abstract(term, TERMKEY_FLAG_UTF8); + tui->termkey = termkey_new_abstract(term, UI_TERMKEY_FLAGS); } if (!tui->termkey) goto err; -- cgit v1.2.3