changeset 23404:a6b6bcc004f2 v8.2.2245

patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed Commit: https://github.com/vim/vim/commit/285b15fce164ade8b1537b884cc15aebaa60e9ef Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 29 20:25:19 2020 +0100 patch 8.2.2245: Vim9: return value of winrestcmd() cannot be executed Problem: Vim9: return value of winrestcmd() cannot be executed. Solution: Put colons before each range. (closes https://github.com/vim/vim/issues/7571)
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Dec 2020 20:30:06 +0100
parents 370b7b1726a3
children 9f9f30f22f42
files src/evalwindow.c src/testdir/test_vim9_builtin.vim src/version.c
diffstat 3 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalwindow.c
+++ b/src/evalwindow.c
@@ -1010,9 +1010,9 @@ f_winrestcmd(typval_T *argvars UNUSED, t
     ga_init2(&ga, (int)sizeof(char), 70);
     FOR_ALL_WINDOWS(wp)
     {
-	sprintf((char *)buf, "%dresize %d|", winnr, wp->w_height);
+	sprintf((char *)buf, ":%dresize %d|", winnr, wp->w_height);
 	ga_concat(&ga, buf);
-	sprintf((char *)buf, "vert %dresize %d|", winnr, wp->w_width);
+	sprintf((char *)buf, "vert :%dresize %d|", winnr, wp->w_width);
 	ga_concat(&ga, buf);
 	++winnr;
     }
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -716,5 +716,15 @@ def Test_win_splitmove()
   close
 enddef
 
+def Test_winrestcmd()
+  split
+  var cmd = winrestcmd()
+  wincmd _
+  exe cmd
+  assert_equal(cmd, winrestcmd())
+  close
+enddef
+
+
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2245,
+/**/
     2244,
 /**/
     2243,