]> granicus.if.org Git - vim/commitdiff
patch 8.2.0518: a terminal falls back to setting $TERM to "xterm" v8.2.0518
authorBram Moolenaar <Bram@vim.org>
Sun, 5 Apr 2020 19:42:12 +0000 (21:42 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 5 Apr 2020 19:42:12 +0000 (21:42 +0200)
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)

src/os_unix.c
src/version.c

index c0a4fdbe3878c82db736eee7ace884683a8671e6..397342c6848289f129fbe796388ac2e3f24b8e7f 100644 (file)
@@ -5493,7 +5493,14 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal)
            // 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,
index 4c07cd2e78cfc1e8aa99463e0f392710ee2695f8..f420990b9c637ecdeb92b7c1f6d67d41e037eefc 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    518,
 /**/
     517,
 /**/