diff options
author | James McCoy <jamessan@jamessan.com> | 2021-12-05 22:11:08 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2021-12-08 21:47:58 -0500 |
commit | 5fda23c307404a9d7d0e4d7b592df503ed1cb110 (patch) | |
tree | 5d1fa5e0bc534ad5ac57c6699b68b90d0340ace0 /src | |
parent | 4453d4c9f1e2cb93bf42e24a622ff00134d7229f (diff) | |
download | rneovim-5fda23c307404a9d7d0e4d7b592df503ed1cb110.tar.gz rneovim-5fda23c307404a9d7d0e4d7b592df503ed1cb110.tar.bz2 rneovim-5fda23c307404a9d7d0e4d7b592df503ed1cb110.zip |
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.
https://github.com/vim/vim/commit/e5710a02cb78c2a0a868ea55740835c78ddecbb4
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/globals.h | 2 | ||||
-rw-r--r-- | src/nvim/sign.c | 28 | ||||
-rw-r--r-- | src/nvim/testdir/test_signs.vim | 5 |
3 files changed, 0 insertions, 35 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 46506a59cb..b2422fd531 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -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")); diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 8409c07439..32be714184 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -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); diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim index c570d2c37e..799e6cb57b 100644 --- a/src/nvim/testdir/test_signs.vim +++ b/src/nvim/testdir/test_signs.vim @@ -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] |