aboutsummaryrefslogtreecommitdiff
path: root/ui-terminal-vt100.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-03-22 19:53:22 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-03-22 19:53:22 +0100
commitfc0efcc89825ef1f61ffe5744b58f7d4e16c2aae (patch)
tree607fa0c0469e026e220c25a646cd0ec649eb7916 /ui-terminal-vt100.c
parentc9a259bbe118d60558a8891e0bd701e8fb0ba91d (diff)
downloadvis-fc0efcc89825ef1f61ffe5744b58f7d4e16c2aae.tar.gz
vis-fc0efcc89825ef1f61ffe5744b58f7d4e16c2aae.tar.xz
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.
Diffstat (limited to 'ui-terminal-vt100.c')
-rw-r--r--ui-terminal-vt100.c10
1 files changed, 7 insertions, 3 deletions
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 <stdio.h>
#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) {