From 43605fded457cec954600b688d54242341eedc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 11 Nov 2015 22:51:10 +0100 Subject: 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. --- ui-curses.c | 7 +++++-- 1 file 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(); -- cgit v1.2.3