]> granicus.if.org Git - vim/commitdiff
patch 8.2.4896: expression in command block does not look after NL v8.2.4896
authorBram Moolenaar <Bram@vim.org>
Fri, 6 May 2022 20:24:31 +0000 (21:24 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 6 May 2022 20:24:31 +0000 (21:24 +0100)
Problem:    Expression in command block does not look after NL when command is
            typed.
Solution:   Skip over NL also when not in a script. (closes #10358)

src/eval.c
src/testdir/test_usercommands.vim
src/version.c

index 18e196f443d8fa64e9163e5de1968ac6920bc4b5..317446c7623da7a904ea53b5bc1e1621091e9868 100644 (file)
@@ -2175,7 +2175,8 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext)
     *getnext = FALSE;
     if (in_vim9script()
            && evalarg != NULL
-           && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL)
+           && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL
+                                                                  || *p == NL)
            && (*p == NUL || *p == NL
                             || (vim9_comment_start(p) && VIM_ISWHITE(p[-1]))))
     {
index 8c588c55e3c1a795de5f6e8363aca9969254de36..3cb1c8b3fbc1b92a8f57dc2f179f3a0c34ff3e6a 100644 (file)
@@ -705,6 +705,11 @@ func Test_usercmd_with_block()
   END
   call v9.CheckScriptSuccess(lines)
   call assert_equal('true', g:result)
+  unlet g:result
+
+  call feedkeys(":EchoCond\<CR>", 'xt')
+  call assert_equal('true', g:result)
+
   delcommand EchoCond
   unlet g:result
 
index df306852f57bdd791f571340d8eecd97ceb69b70..d20ecf21639d3382926f98c18317af7edc012211 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4896,
 /**/
     4895,
 /**/