vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 16ced6b36837cc61602dc4e439a990d942a6734d parent d6a14e902381918bf39023ed4ed07c2d6b842560 Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 17 Nov 2015 22:40:55 +0100 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 184a749ff9fe38191bf0ef463fb844d967cdfe6e Closes #105 Diffstat:
| M | Makefile | | | 2 | +- |
| M | ui-curses.c | | | 2 | +- |
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile @@ -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 @@ -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();