vim-patch:8.2.3748: giving an error for an empty sign argument breaks a plugin

Problem:    Giving an error for an empty sign argument breaks a plugin.
Solution:   Do not give an error.
e5710a02cb
This commit is contained in:
James McCoy 2021-12-05 22:11:08 -05:00
parent 4453d4c9f1
commit 5fda23c307
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
3 changed files with 0 additions and 35 deletions

View File

@ -997,8 +997,6 @@ EXTERN char e_non_empty_string_required[] INIT(= N_("E1142: Non-empty string req
EXTERN char e_cannot_define_autocommands_for_all_events[] INIT(= N_("E1155: Cannot define autocommands for ALL events"));
EXTERN char e_group_name_missing_for_str[] INIT(= N_("E1249: Group name missing for %s"));
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));

View File

@ -1148,15 +1148,6 @@ linenr_T sign_jump(int sign_id, char_u *sign_group, buf_T *buf)
return lnum;
}
static int check_empty_group(size_t len, char *name)
{
if (len == 0) {
semsg(_(e_group_name_missing_for_str), name);
return FAIL;
}
return OK;
}
/// ":sign define {name} ..." command
static void sign_define_cmd(char_u *sign_name, char_u *cmdline)
{
@ -1169,9 +1160,6 @@ static void sign_define_cmd(char_u *sign_name, char_u *cmdline)
char_u *culhl = NULL;
char_u *numhl = NULL;
int failed = false;
sign_T *sp_prev;
bool exists = sign_find(sign_name, &sp_prev) != NULL;
// set values for a defined sign.
for (;;) {
@ -1188,31 +1176,15 @@ static void sign_define_cmd(char_u *sign_name, char_u *cmdline)
text = vim_strnsave(arg, (size_t)(p - arg));
} else if (STRNCMP(arg, "linehl=", 7) == 0) {
arg += 7;
if (!exists && check_empty_group(p - arg, "linehl") == FAIL) {
failed = true;
break;
}
linehl = vim_strnsave(arg, (size_t)(p - arg));
} else if (STRNCMP(arg, "texthl=", 7) == 0) {
arg += 7;
if (!exists && check_empty_group(p - arg, "texthl") == FAIL) {
failed = true;
break;
}
texthl = vim_strnsave(arg, (size_t)(p - arg));
} else if (STRNCMP(arg, "culhl=", 6) == 0) {
arg += 6;
if (!exists && check_empty_group(p - arg, "culhl") == FAIL) {
failed = true;
break;
}
culhl = vim_strnsave(arg, (size_t)(p - arg));
} else if (STRNCMP(arg, "numhl=", 6) == 0) {
arg += 6;
if (!exists && check_empty_group(p - arg, "numhl") == FAIL) {
failed = true;
break;
}
numhl = vim_strnsave(arg, (size_t)(p - arg));
} else {
semsg(_(e_invarg2), arg);

View File

@ -126,11 +126,6 @@ func Test_sign()
" call assert_fails("sign define Sign4 text= linehl=Comment", 'E239:')
call assert_fails("sign define Sign4 text=\\ ab linehl=Comment", 'E239:')
" an empty highlight argument for a new sign is an error
call assert_fails("sign define SignX linehl=", 'E1249: Group name missing for linehl')
call assert_fails("sign define SignX culhl=", 'E1249: Group name missing for culhl')
call assert_fails("sign define SignX texthl=", 'E1249: Group name missing for texthl')
" an empty highlight argument for an existing sign clears it
sign define SignY texthl=TextHl culhl=CulHl linehl=LineHl
let sl = sign_getdefined('SignY')[0]