diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-11-17 22:40:55 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-11-17 22:40:55 +0100 |
| commit | 91c043a5382e142d7ea69d47c29c74a2172e9f60 (patch) | |
| tree | ca2aeb8f4986c780ebd23817c8bd65fc07638890 | |
| parent | d72a2928e49139a39bd5ccd77dfedda8b01faac1 (diff) | |
| download | vis-91c043a5382e142d7ea69d47c29c74a2172e9f60.tar.gz vis-91c043a5382e142d7ea69d47c29c74a2172e9f60.tar.xz | |
ui: improve fallback code in case of unknown term
If the current $TERM value indicates 256 color support fall back
to xterm-256color otherwise try xterm.
Improves upon 43605fded457cec954600b688d54242341eedc7c
Closes #105
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | ui-curses.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -29,7 +29,7 @@ LIBLUA_SHA1 = b3882111ad02ecc6b972f8c1241647905cb2e3fc LIBLPEG = lpeg-1.0.0 LIBLPEG_SHA1 = 64a0920c9243b624a277c987d2219b6c50c43971 -LIBNCURSES_CONFIG = --disable-database --with-fallbacks=st-256color,xterm-256color,vt100 \ +LIBNCURSES_CONFIG = --disable-database --with-fallbacks=st,st-256color,xterm,xterm-256color,vt100 \ --with-shared --enable-widec --enable-ext-colors --with-termlib=tinfo \ --without-ada --without-cxx --without-cxx-binding --without-manpages --without-progs \ --without-tests --without-progs --without-debug --without-profile \ diff --git a/ui-curses.c b/ui-curses.c index 4b8387b..58c1298 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -1081,7 +1081,7 @@ Ui *ui_curses_new(void) { term = "xterm"; if (!newterm(term, stderr, stdin)) { snprintf(uic->info, sizeof(uic->info), "Warning: unknown term `%s'", term); - if (!newterm("xterm-256color", stderr, stdin)) + if (!newterm(strstr(term, "-256color") ? "xterm-256color" : "xterm", stderr, stdin)) goto err; } start_color(); |
