To: vim_dev@googlegroups.com Subject: Patch 8.2.5051 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///