Skip to content

Commit 5ba8d35

Browse files
committed
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)
1 parent 4c68375 commit 5ba8d35

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/os_unix.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5493,7 +5493,14 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal)
54935493
// Use 'term' or $TERM if it starts with "xterm", otherwise fall
54945494
// back to "xterm".
54955495
if (term == NULL || *term == NUL || STRNCMP(term, "xterm", 5) != 0)
5496-
term = "xterm";
5496+
{
5497+
if (t_colors > 16)
5498+
term = "xterm-color";
5499+
if (t_colors >= 256)
5500+
term = "xterm-256color";
5501+
else
5502+
term = "xterm";
5503+
}
54975504
set_child_environment(
54985505
(long)options->jo_term_rows,
54995506
(long)options->jo_term_cols,

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
518,
741743
/**/
742744
517,
743745
/**/

0 commit comments

Comments
 (0)