mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 8.2.3747: cannot remove highlight from an existing sign
Problem: Cannot remove highlight from an existing sign. (James McCoy) Solution: Only reject empty argument for a new sign.
This commit is contained in:
33
src/sign.c
33
src/sign.c
@@ -1078,13 +1078,28 @@ sign_define_by_name(
|
||||
return FAIL;
|
||||
|
||||
if (linehl != NULL)
|
||||
sp->sn_line_hl = syn_check_group(linehl, (int)STRLEN(linehl));
|
||||
{
|
||||
if (*linehl == NUL)
|
||||
sp->sn_line_hl = 0;
|
||||
else
|
||||
sp->sn_line_hl = syn_check_group(linehl, (int)STRLEN(linehl));
|
||||
}
|
||||
|
||||
if (texthl != NULL)
|
||||
sp->sn_text_hl = syn_check_group(texthl, (int)STRLEN(texthl));
|
||||
{
|
||||
if (*texthl == NUL)
|
||||
sp->sn_text_hl = 0;
|
||||
else
|
||||
sp->sn_text_hl = syn_check_group(texthl, (int)STRLEN(texthl));
|
||||
}
|
||||
|
||||
if (culhl != NULL)
|
||||
sp->sn_cul_hl = syn_check_group(culhl, (int)STRLEN(culhl));
|
||||
{
|
||||
if (*culhl == NUL)
|
||||
sp->sn_cul_hl = 0;
|
||||
else
|
||||
sp->sn_cul_hl = syn_check_group(culhl, (int)STRLEN(culhl));
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -1319,7 +1334,11 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
|
||||
char_u *linehl = NULL;
|
||||
char_u *texthl = NULL;
|
||||
char_u *culhl = NULL;
|
||||
int failed = FALSE;
|
||||
int failed = FALSE;
|
||||
sign_T *sp_prev;
|
||||
int exists;
|
||||
|
||||
exists = sign_find(sign_name, &sp_prev) != NULL;
|
||||
|
||||
// set values for a defined sign.
|
||||
for (;;)
|
||||
@@ -1341,7 +1360,7 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
|
||||
else if (STRNCMP(arg, "linehl=", 7) == 0)
|
||||
{
|
||||
arg += 7;
|
||||
if (check_empty_group(p - arg, "linehl") == FAIL)
|
||||
if (!exists && check_empty_group(p - arg, "linehl") == FAIL)
|
||||
{
|
||||
failed = TRUE;
|
||||
break;
|
||||
@@ -1351,7 +1370,7 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
|
||||
else if (STRNCMP(arg, "texthl=", 7) == 0)
|
||||
{
|
||||
arg += 7;
|
||||
if (check_empty_group(p - arg, "texthl") == FAIL)
|
||||
if (!exists && check_empty_group(p - arg, "texthl") == FAIL)
|
||||
{
|
||||
failed = TRUE;
|
||||
break;
|
||||
@@ -1361,7 +1380,7 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
|
||||
else if (STRNCMP(arg, "culhl=", 6) == 0)
|
||||
{
|
||||
arg += 6;
|
||||
if (check_empty_group(p - arg, "culhl") == FAIL)
|
||||
if (!exists && check_empty_group(p - arg, "culhl") == FAIL)
|
||||
{
|
||||
failed = TRUE;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user