From: Bruno Haible Date: Sun, 31 Mar 2019 14:50:40 +0000 (+0200) Subject: libtextstyle: Support for terminal types with 256 colors. X-Git-Tag: v0.20~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d729bb1ee895403192b9f9a2404f280f6ca5810;p=thirdparty%2Fgettext.git libtextstyle: Support for terminal types with 256 colors. * gnulib-local/lib/term-ostream.oo.c (term_ostream_create): Accept all $TERM values that end in -16color or -256 color (such as Eterm-256color, mlterm-256color, or putty-256color). * libtextstyle/NEWS: Mention the change. --- diff --git a/gnulib-local/lib/term-ostream.oo.c b/gnulib-local/lib/term-ostream.oo.c index 447af9968..5d3cf0698 100644 --- a/gnulib-local/lib/term-ostream.oo.c +++ b/gnulib-local/lib/term-ostream.oo.c @@ -2210,10 +2210,12 @@ term_ostream_create (int fd, const char *filename, ttyctl_t tty_control) ? (term != NULL && (/* Recognize xterm-16color, xterm-88color, xterm-256color. */ (strlen (term) >= 5 && memcmp (term, "xterm", 5) == 0) - || /* Recognize rxvt-16color. */ - (strlen (term) >= 4 && memcmp (term, "rxvt", 4) == 0) - || /* Recognize konsole-16color. */ - (strlen (term) >= 7 && memcmp (term, "konsole", 7) == 0)) + || /* Recognize *-16color. */ + (strlen (term) > 8 + && strcmp (term + strlen (term) - 8, "-16color") == 0) + || /* Recognize *-256color. */ + (strlen (term) > 9 + && strcmp (term + strlen (term) - 9, "-256color") == 0)) ? (stream->max_colors == 256 ? cm_xterm256 : stream->max_colors == 88 ? cm_xterm88 : stream->max_colors == 16 ? cm_xterm16 : diff --git a/libtextstyle/NEWS b/libtextstyle/NEWS index cacd94630..1ea300cb7 100644 --- a/libtextstyle/NEWS +++ b/libtextstyle/NEWS @@ -6,6 +6,7 @@ New in 0.8: with a low probability. - The SIGTSTP and SIGCONT signal handlers could clobber errno. * Added support for Windows consoles. +* Improved support for TERM=Eterm-256color and TERM=mlterm-256color. New in 0.7: * Reliable tty control, as described by the ttyctl_t enum, is now implemented.