Patch 8.2.5051
Problem:    Check for autocmd_add() event argument is confusing.
Solution:   Make the code more straightforward.
Files:      src/autocmd.c


*** ../vim-8.2.5050/src/autocmd.c       2022-06-01 12:31:05.194803595 +0100
--- src/autocmd.c       2022-06-01 15:57:59.031080641 +0100
***************
*** 2951,2976 ****
                    if (eli == NULL)
                        break;
                    if (eli->li_tv.v_type != VAR_STRING
!                           || eli->li_tv.vval.v_string == NULL)
                    {
                        emsg(_(e_string_required));
!                       continue;
                    }
-                   p = eli->li_tv.vval.v_string;
                }
                else
                {
!                   if (end == NULL)
!                       p = end = event_name;
!                   if (end == NULL || *end == NUL)
                        break;
                }
-               if (p == NULL)
-                   continue;
  
                event = event_name2nr(p, &end);
                if (event == NUM_EVENTS || *end != NUL)
                {
                    semsg(_(e_no_such_event_str), p);
                    retval = VVAL_FALSE;
                    break;
--- 2951,2974 ----
                    if (eli == NULL)
                        break;
                    if (eli->li_tv.v_type != VAR_STRING
!                           || (p = eli->li_tv.vval.v_string) == NULL)
                    {
                        emsg(_(e_string_required));
!                       break;
                    }
                }
                else
                {
!                   if (p == NULL)
!                       p = event_name;
!                   if (p == NULL || *p == NUL)
                        break;
                }
  
                event = event_name2nr(p, &end);
                if (event == NUM_EVENTS || *end != NUL)
                {
+                   // this also catches something following a valid event name
                    semsg(_(e_no_such_event_str), p);
                    retval = VVAL_FALSE;
                    break;
*** ../vim-8.2.5050/src/version.c       2022-06-01 15:23:07.826491258 +0100
--- src/version.c       2022-06-01 15:59:02.151180027 +0100
***************
*** 736,737 ****
--- 736,739 ----
  {   /* Add new patch number below this line */
+ /**/
+     5051,
  /**/

-- 
Individualists unite!

 /// 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/20220601150303.285C61C15EC%40moolenaar.net.

Raspunde prin e-mail lui