Skip to content

Commit 1ff89de

Browse files
committed
patch 8.2.2649: Vim9: some wincmd arguments cause a white space error
Problem: Vim9: some wincmd arguments cause a white space error. Solution: Insert a space before the count. (closes #8001)
1 parent c54f347 commit 1ff89de

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

src/testdir/test_vim9_cmd.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,27 @@ def Test_wincmd()
10561056
endif
10571057
assert_notequal(id1, win_getid())
10581058
close
1059+
1060+
split
1061+
var id = win_getid()
1062+
split
1063+
:2wincmd o
1064+
assert_equal(id, win_getid())
1065+
only
1066+
1067+
split
1068+
split
1069+
assert_equal(3, winnr('$'))
1070+
:2wincmd c
1071+
assert_equal(2, winnr('$'))
1072+
only
1073+
1074+
split
1075+
split
1076+
assert_equal(3, winnr('$'))
1077+
:2wincmd q
1078+
assert_equal(2, winnr('$'))
1079+
only
10591080
enddef
10601081

10611082
def Test_windo_missing_endif()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2649,
753755
/**/
754756
2648,
755757
/**/

src/window.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,11 +750,10 @@ cmd_with_count(
750750
size_t bufsize,
751751
long Prenum)
752752
{
753-
size_t len = STRLEN(cmd);
754-
755-
STRCPY(bufp, cmd);
756753
if (Prenum > 0)
757-
vim_snprintf((char *)bufp + len, bufsize - len, "%ld", Prenum);
754+
vim_snprintf((char *)bufp, bufsize, "%s %ld", cmd, Prenum);
755+
else
756+
STRCPY(bufp, cmd);
758757
}
759758

760759
/*

0 commit comments

Comments
 (0)