]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.2281: Vim9: compiled "wincmd" cannot be followed by bar v8.2.2281
authorBram Moolenaar <Bram@vim.org>
Sat, 2 Jan 2021 18:44:56 +0000 (19:44 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 2 Jan 2021 18:44:56 +0000 (19:44 +0100)
Problem:    Vim9: compiled "wincmd" cannot be followed by bar.
Solution:   Check for bar after "wincmd". (closes #7599)

src/testdir/test_vim9_cmd.vim
src/version.c
src/vim9compile.c

index 095158c51754b996844c2a8357172d923ec10ae5..ab311006829eb03c6b043dfc62dbad3f19c01043 100644 (file)
@@ -868,4 +868,14 @@ def Test_insert_complete()
   bwipe!
 enddef
 
+def Test_wincmd()
+  split
+  var id1 = win_getid()
+  if true
+    try | wincmd w | catch | endtry
+  endif
+  assert_notequal(id1, win_getid())
+  close
+enddef
+
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
index 4d31dc7f2a2c35b60ef5d4ecbceaa30834c9ab13..b54cf0a39582722acc3f8bc8d25358805cb01b31 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2281,
 /**/
     2280,
 /**/
index 23da8f2d11cd6b9c1edee0b17bbc19250a14a0e8..2a2b44eac400000b56726fe360d2dc9f52618085 100644 (file)
@@ -7329,6 +7329,20 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
            if (eap->nextcmd != NULL)
                nextcmd = eap->nextcmd;
        }
+       else if (eap->cmdidx == CMD_wincmd)
+       {
+           p = eap->arg;
+           if (*p != NUL)
+               ++p;
+           if (*p == 'g' || *p == Ctrl_G)
+               ++p;
+           p = skipwhite(p);
+           if (*p == '|')
+           {
+               *p = NUL;
+               nextcmd = p + 1;
+           }
+       }
     }
 
     if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0)