Patch 8.2.3748 (after 8.2.3747)
Problem:    Giving an error for an empty sign argument breaks a plugin.
Solution:   Do not give an error.
Files:      src/sign.c, src/errors.h, src/testdir/test_signs.vim


*** ../vim-8.2.3747/src/sign.c  2021-12-05 17:45:46.235175728 +0000
--- src/sign.c  2021-12-05 19:07:41.775972281 +0000
***************
*** 1310,1326 ****
      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
   */
--- 1310,1315 ----
***************
*** 1335,1344 ****
      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 (;;)
--- 1324,1329 ----
***************
*** 1360,1390 ****
        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
--- 1345,1360 ----
*** ../vim-8.2.3747/src/errors.h        2021-12-05 13:02:47.028928408 +0000
--- src/errors.h        2021-12-05 19:05:16.428250263 +0000
***************
*** 694,698 ****
        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"));
--- 694,696 ----
*** ../vim-8.2.3747/src/testdir/test_signs.vim  2021-12-05 17:45:46.235175728 
+0000
--- src/testdir/test_signs.vim  2021-12-05 19:09:12.063798695 +0000
***************
*** 126,136 ****
    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]
--- 126,131 ----
*** ../vim-8.2.3747/src/version.c       2021-12-05 17:45:46.235175728 +0000
--- src/version.c       2021-12-05 19:06:15.836136890 +0000
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     3748,
  /**/

-- 
Imagine a world without hypothetical situations.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211205191100.31A731C0BD1%40moolenaar.net.

Raspunde prin e-mail lui