Patch 8.2.1771

5 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 29, 2020, 2:59:58 PM9/29/20
to vim...@googlegroups.com

Patch 8.2.1771
Problem: synIDattr() cannot get the value of ctermul.
Solution: Add the "ul" value for "what". (closes #7037)
Files: runtime/doc/eval.txt, src/highlight.c, src/evalfunc.c,
src/testdir/test_highlight.vim


*** ../vim-8.2.1770/runtime/doc/eval.txt 2020-09-25 22:42:43.852669232 +0200
--- runtime/doc/eval.txt 2020-09-29 20:28:20.754676604 +0200
***************
*** 10296,10302 ****
"bg" background color (as with "fg")
"font" font name (only available in the GUI)
|highlight-font|
! "sp" special color (as with "fg") |highlight-guisp|
"fg#" like "fg", but for the GUI and the GUI is
running the name in "#RRGGBB" form
"bg#" like "fg#" for "bg"
--- 10348,10356 ----
"bg" background color (as with "fg")
"font" font name (only available in the GUI)
|highlight-font|
! "sp" special color for the GUI (as with "fg")
! |highlight-guisp|
! "ul" underline color for cterm: number as a string
"fg#" like "fg", but for the GUI and the GUI is
running the name in "#RRGGBB" form
"bg#" like "fg#" for "bg"
*** ../vim-8.2.1770/src/highlight.c 2020-09-18 19:40:41.662037673 +0200
--- src/highlight.c 2020-09-29 20:26:51.026895294 +0200
***************
*** 2684,2696 ****
char_u *
highlight_color(
int id,
! char_u *what, // "font", "fg", "bg", "sp", "fg#", "bg#" or "sp#"
int modec) // 'g' for GUI, 'c' for cterm, 't' for term
{
static char_u name[20];
int n;
int fg = FALSE;
int sp = FALSE;
int font = FALSE;

if (id <= 0 || id > highlight_ga.ga_len)
--- 2684,2697 ----
char_u *
highlight_color(
int id,
! char_u *what, // "font", "fg", "bg", "sp", "ul", "fg#", "bg#" or "sp#"
int modec) // 'g' for GUI, 'c' for cterm, 't' for term
{
static char_u name[20];
int n;
int fg = FALSE;
int sp = FALSE;
+ int ul = FALSE;
int font = FALSE;

if (id <= 0 || id > highlight_ga.ga_len)
***************
*** 2703,2708 ****
--- 2704,2711 ----
font = TRUE;
else if (TOLOWER_ASC(what[0]) == 's' && TOLOWER_ASC(what[1]) == 'p')
sp = TRUE;
+ else if (TOLOWER_ASC(what[0]) == 'u' && TOLOWER_ASC(what[1]) == 'l')
+ ul = TRUE;
else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g'))
return NULL;
if (modec == 'g')
***************
*** 2749,2754 ****
--- 2752,2759 ----
{
if (fg)
n = HL_TABLE()[id - 1].sg_cterm_fg - 1;
+ else if (ul)
+ n = HL_TABLE()[id - 1].sg_cterm_ul - 1;
else
n = HL_TABLE()[id - 1].sg_cterm_bg - 1;
if (n < 0)
*** ../vim-8.2.1770/src/evalfunc.c 2020-09-28 22:29:25.421766301 +0200
--- src/evalfunc.c 2020-09-29 20:30:35.730339036 +0200
***************
*** 8604,8610 ****
break;

case 'u':
! if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c')
// underline
p = highlight_has_attr(id, HL_UNDERLINE, modec);
else
--- 8604,8612 ----
break;

case 'u':
! if (TOLOWER_ASC(what[1]) == 'l') // ul
! p = highlight_color(id, what, modec);
! else if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c')
// underline
p = highlight_has_attr(id, HL_UNDERLINE, modec);
else
*** ../vim-8.2.1770/src/testdir/test_highlight.vim 2020-09-18 21:55:22.937915802 +0200
--- src/testdir/test_highlight.vim 2020-09-29 20:33:17.309924459 +0200
***************
*** 808,813 ****
--- 808,814 ----
call assert_notmatch('ctermul=', HighlightArgs('Normal'))
highlight Normal ctermul=3
call assert_match('ctermul=3', HighlightArgs('Normal'))
+ call assert_equal('3', synIDattr(synIDtrans(hlID('Normal')), 'ul'))
highlight Normal ctermul=NONE
endfunc

*** ../vim-8.2.1770/src/version.c 2020-09-28 23:13:09.950705432 +0200
--- src/version.c 2020-09-29 20:29:27.278511382 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1771,
/**/

--
hundred-and-one symptoms of being an internet addict:
18. Your wife drapes a blond wig over your monitor to remind you of what she
looks like.

/// 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 ///
Reply all
Reply to author
Forward
0 new messages