]> granicus.if.org Git - vim/commitdiff
patch 8.2.3748: giving an error for an empty sign argument breaks a plugin v8.2.3748
authorBram Moolenaar <Bram@vim.org>
Sun, 5 Dec 2021 19:10:04 +0000 (19:10 +0000)
committerBram Moolenaar <Bram@vim.org>
Sun, 5 Dec 2021 19:10:04 +0000 (19:10 +0000)
Problem:    Giving an error for an empty sign argument breaks a plugin.
Solution:   Do not give an error.

src/errors.h
src/sign.c
src/testdir/test_signs.vim
src/version.c

index e035f076d83d5eeddcd416d206f1a71cbb0ad01f..96aef67fcb9ef579b7d935cd513ea42277570ae3 100644 (file)
@@ -694,5 +694,3 @@ EXTERN char e_line_number_out_of_range[]
        INIT(= N_("E1247: Line number out of range"));
 EXTERN char e_closure_called_from_invalid_context[]
        INIT(= N_("E1248: Closure called from invalid context"));
-EXTERN char e_group_name_missing_for_str[]
-       INIT(= N_("E1249: Group name missing for %s"));
index 2c102e4e5285838ffd12511e0d9296fd3c70e1b0..e358ee97527122bfc2df32ad6bfd43edee595400 100644 (file)
@@ -1310,17 +1310,6 @@ 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
  */
@@ -1335,10 +1324,6 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
     char_u     *texthl = NULL;
     char_u     *culhl = NULL;
     int                failed = FALSE;
-    sign_T     *sp_prev;
-    int                exists;
-
-    exists = sign_find(sign_name, &sp_prev) != NULL;
 
     // set values for a defined sign.
     for (;;)
@@ -1360,31 +1345,16 @@ sign_define_cmd(char_u *sign_name, char_u *cmdline)
        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, 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, 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, p - arg);
        }
        else
index 8511708ace7c48f5faf58196da1f41811ef73d07..a1ffdf5cfd13c3c9e59e81ba94db9140428b85aa 100644 (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]
index e7b0b2e2d030f503f9d4e4997719ff75be924de4..17dfe9891aac90782ad99f62c201669fcf675b65 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3748,
 /**/
     3747,
 /**/