aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-11-11 22:51:10 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-11-11 22:51:10 +0100
commit43605fded457cec954600b688d54242341eedc7c (patch)
tree557fc22498b2b77e2fffb2f2d699289a44bbb0c1
parent131a635c94c2db293a11aa9fbe5f1c2877623964 (diff)
downloadvis-43605fded457cec954600b688d54242341eedc7c.tar.gz
vis-43605fded457cec954600b688d54242341eedc7c.tar.xz
ui: fall back to xterm-256color if term initialization fails
This improves behaviour for unknwown/unrecognized terminals as is the case for self contained binaries built with "make standalone" which only includes a fixed set of terminal descriptions. Of course the terminal capabilities won't match, which will likely cause some display issues.
-rw-r--r--ui-curses.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ui-curses.c b/ui-curses.c
index 30cf516..4b8387b 100644
--- a/ui-curses.c
+++ b/ui-curses.c
@@ -1079,8 +1079,11 @@ Ui *ui_curses_new(void) {
char *term = getenv("TERM");
if (!term)
term = "xterm";
- if (!newterm(term, stderr, stdin))
- goto err;
+ if (!newterm(term, stderr, stdin)) {
+ snprintf(uic->info, sizeof(uic->info), "Warning: unknown term `%s'", term);
+ if (!newterm("xterm-256color", stderr, stdin))
+ goto err;
+ }
start_color();
use_default_colors();
raw();