Patch 8.2.0646

19 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 26, 2020, 10:53:29 AM4/26/20
to vim...@googlegroups.com

Patch 8.2.0646
Problem: t_Co uses the value of $COLORS in the GUI. (Masato Nishihata)
Solution: Ignore $COLORS for the GUI. (closes #5992)
Files: src/os_unix.c, src/term.c


*** ../vim-8.2.0645/src/os_unix.c 2020-04-14 20:56:27.589970249 +0200
--- src/os_unix.c 2020-04-26 16:43:07.809282873 +0200
***************
*** 4160,4170 ****
static char envbuf_Servername[60];
# endif
# endif
- long colors =
- # ifdef FEAT_GUI
- gui.in_use ? 256*256*256 :
- # endif
- t_colors;

# ifdef HAVE_SETENV
setenv("TERM", term, 1);
--- 4163,4168 ----
***************
*** 4174,4180 ****
setenv("LINES", (char *)envbuf, 1);
sprintf((char *)envbuf, "%ld", columns);
setenv("COLUMNS", (char *)envbuf, 1);
! sprintf((char *)envbuf, "%ld", colors);
setenv("COLORS", (char *)envbuf, 1);
# ifdef FEAT_TERMINAL
if (is_terminal)
--- 4172,4178 ----
setenv("LINES", (char *)envbuf, 1);
sprintf((char *)envbuf, "%ld", columns);
setenv("COLUMNS", (char *)envbuf, 1);
! sprintf((char *)envbuf, "%d", t_colors);
setenv("COLORS", (char *)envbuf, 1);
# ifdef FEAT_TERMINAL
if (is_terminal)
*** ../vim-8.2.0645/src/term.c 2020-04-17 16:40:27.994627345 +0200
--- src/term.c 2020-04-26 16:44:33.320838748 +0200
***************
*** 3122,3136 ****
}
need_gather = TRUE;

! // Set t_colors to the value of $COLORS or t_Co.
t_colors = atoi((char *)T_CCO);
! env_colors = mch_getenv((char_u *)"COLORS");
! if (env_colors != NULL && isdigit(*env_colors))
{
! int colors = atoi((char *)env_colors);

! if (colors != t_colors)
! set_color_count(colors);
}
}

--- 3122,3142 ----
}
need_gather = TRUE;

! // Set t_colors to the value of $COLORS or t_Co. Ignore $COLORS in the
! // GUI.
t_colors = atoi((char *)T_CCO);
! #ifdef FEAT_GUI
! if (!gui.in_use)
! #endif
{
! env_colors = mch_getenv((char_u *)"COLORS");
! if (env_colors != NULL && isdigit(*env_colors))
! {
! int colors = atoi((char *)env_colors);

! if (colors != t_colors)
! set_color_count(colors);
! }
}
}

*** ../vim-8.2.0645/src/version.c 2020-04-26 16:05:58.574358031 +0200
--- src/version.c 2020-04-26 16:52:19.330875713 +0200
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 646,
/**/

--
Computers are useless. They can only give you answers.
-- Pablo Picasso

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

John Marriott

unread,
Apr 28, 2020, 3:00:31 PM4/28/20
to vim...@googlegroups.com

On 27-Apr-2020 00:53, Bram Moolenaar wrote:
> Patch 8.2.0646
> Problem: t_Co uses the value of $COLORS in the GUI. (Masato Nishihata)
> Solution: Ignore $COLORS for the GUI. (closes #5992)
> Files: src/os_unix.c, src/term.c
>
>
>
After this patch HP-UX spits out this error:
    cc -c -I. -Iproto -DHAVE_CONFIG_H     -O2       -D_REENTRANT -o
objects/os_unix.o os_unix.c
cc: "os_unix.c", line 4199: error 1588: "colors" undefined.
cc: "os_unix.c", line 4199: warning 563: Argument #4 is not the correct
type.
*** Error exit code 1

Stop.

The attached patch tries to fix it.
Cheers
John
os_unix.c.8.2.0646.patch

Bram Moolenaar

unread,
Apr 28, 2020, 3:59:08 PM4/28/20
to vim...@googlegroups.com, John Marriott
Looks good, thanks for the fix.

--
How To Keep A Healthy Level Of Insanity:
11. Specify that your drive-through order is "to go".
Reply all
Reply to author
Forward
0 new messages