changeset 19924:851b9af01aad v8.2.0518

patch 8.2.0518: a terminal falls back to setting $TERM to "xterm" Commit: https://github.com/vim/vim/commit/5ba8d3578c835edcfb7e3b132e623c12e62f250b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 5 21:42:12 2020 +0200 patch 8.2.0518: a terminal falls back to setting $TERM to "xterm" Problem: A terminal falls back to setting $TERM to "xterm". Solution: Use "xterm-color" if more than 16 colors are supported and "xterm-256color" if at least 256 colors are supported. (closes #5887)
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Apr 2020 21:45:26 +0200
parents cc6243727bd6
children 8c9845101214
files src/os_unix.c src/version.c
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5493,7 +5493,14 @@ mch_job_start(char **argv, job_T *job, j
 	    // Use 'term' or $TERM if it starts with "xterm", otherwise fall
 	    // back to "xterm".
 	    if (term == NULL || *term == NUL || STRNCMP(term, "xterm", 5) != 0)
-		term = "xterm";
+	    {
+		if (t_colors > 16)
+		    term = "xterm-color";
+		if (t_colors >= 256)
+		    term = "xterm-256color";
+		else
+		    term = "xterm";
+	    }
 	    set_child_environment(
 		    (long)options->jo_term_rows,
 		    (long)options->jo_term_cols,
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    518,
+/**/
     517,
 /**/
     516,