Patch 8.2.3743
Problem: ":sign" can add a highlight group without a name.
Solution: Give an error if the group name is missing. (closes #9280)
Files: src/sign.c, src/errors.h, src/testdir/test_signs.vim
*** ../vim-8.2.3742/src/sign.c 2021-11-24 16:19:41.389010087 +0000
--- src/sign.c 2021-12-05 12:56:21.113470167 +0000
***************
*** 1295,1300 ****
--- 1295,1311 ----
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
*/
***************
*** 1330,1345 ****
--- 1341,1371 ----
else if (STRNCMP(arg, "linehl=", 7) == 0)
{
arg += 7;
+ if (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 (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 (check_empty_group(p - arg, "culhl") == FAIL)
+ {
+ failed = TRUE;
+ break;
+ }
culhl = vim_strnsave(arg, p - arg);
}
else
*** ../vim-8.2.3742/src/errors.h 2021-12-02 20:44:38.703106821 +0000
--- src/errors.h 2021-12-05 12:52:17.025802456 +0000
***************
*** 694,696 ****
--- 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"));
*** ../vim-8.2.3742/src/testdir/test_signs.vim 2021-11-24 16:19:41.393010087
+0000
--- src/testdir/test_signs.vim 2021-12-05 13:02:14.616984049 +0000
***************
*** 126,131 ****
--- 126,135 ----
call assert_fails("sign define Sign4 text= linehl=Comment", 'E239:')
call assert_fails("sign define Sign4 text=\\ ab linehl=Comment", 'E239:')
+ call assert_fails("sign define Sign4 linehl=", 'E1249: Group name missing
for linehl')
+ call assert_fails("sign define Sign4 culhl=", 'E1249: Group name missing
for culhl')
+ call assert_fails("sign define Sign4 texthl=", 'E1249: Group name missing
for texthl')
+
" define sign with whitespace
sign define Sign4 text=\ X linehl=Comment
sign undefine Sign4
*** ../vim-8.2.3742/src/version.c 2021-12-05 12:39:15.098817937 +0000
--- src/version.c 2021-12-05 12:54:51.993591909 +0000
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 3743,
/**/
--
While it's true that many normal people whould prefer not to _date_ an
engineer, most normal people harbor an intense desire to _mate_ with them,
thus producing engineerlike children who will have high-paying jobs long
before losing their virginity.
(Scott Adams - The Dilbert principle)
/// 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/20211205130315.6E69D1C0BD1%40moolenaar.net.