summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Akram <mohd.akram@outlook.com>2024-08-01 22:53:01 +0200
committerChristian Brabandt <cb@256bit.org>2024-08-01 22:53:01 +0200
commit0214680a8ec5f7f656cb42e5db19243709202ed2 (patch)
tree73e3919ea1f10b154d4086814f9bd2faf29412c0
parente8feaa354e685e527198093904492f67c52c2302 (diff)
patch 9.1.0651: ex: trailing dot is optional for :g and :insert/:appendv9.1.0651
Problem: ex: trailing dot is optional for :g and :insert/:append Solution: don't break out early, when the next command is empty. (Mohamed Akram) The terminating period is optional for the last command in a global command list. closes: #15407 Signed-off-by: Mohamed Akram <mohd.akram@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/ex_cmds.c4
-rw-r--r--src/testdir/test_ex_mode.vim9
-rw-r--r--src/version.c2
3 files changed, 14 insertions, 1 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index c365937983..4793737560 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3370,7 +3370,7 @@ ex_append(exarg_T *eap)
{
// No getline() function, use the lines that follow. This ends
// when there is no more.
- if (eap->nextcmd == NULL || *eap->nextcmd == NUL)
+ if (eap->nextcmd == NULL)
break;
p = vim_strchr(eap->nextcmd, NL);
if (p == NULL)
@@ -3378,6 +3378,8 @@ ex_append(exarg_T *eap)
theline = vim_strnsave(eap->nextcmd, p - eap->nextcmd);
if (*p != NUL)
++p;
+ else
+ p = NULL;
eap->nextcmd = p;
}
else
diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim
index a1ec15d7e2..aa949355f4 100644
--- a/src/testdir/test_ex_mode.vim
+++ b/src/testdir/test_ex_mode.vim
@@ -378,4 +378,13 @@ func Test_insert_after_trailing_bar()
bwipe!
endfunc
+" Test global insert of a newline without terminating period
+func Test_global_insert_newline()
+ new
+ call setline(1, ['foo'])
+ call feedkeys("Qg/foo/i\\\n", "xt")
+ call assert_equal(['', 'foo'], getline(1, '$'))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index c8527db604..07622ac3d6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 651,
+/**/
650,
/**/
649,