# HG changeset patch # User Christian Brabandt # Date 1721196814 -7200 # Node ID d62088033ab6f337bfc8cd15f08a5277a9cdf804 # Parent e81747dc80347723216c790de80a1e78a1369387 patch 9.1.0582: Printed line doesn't overwrite colon when pressing Enter in Ex mode Commit: https://github.com/vim/vim/commit/7d664bf0eb2cb25cb77933c8b7f11ca09929e7b8 Author: zeertzjq Date: Sun Jul 14 10:22:54 2024 +0200 patch 9.1.0582: Printed line doesn't overwrite colon when pressing Enter in Ex mode Problem: Printed line no longer overwrites colon when pressing Enter in Ex mode (after 9.1.0573). Solution: Restore the behavior of pressing Enter in Ex mode. (zeertzjq) closes: #15258 Signed-off-by: zeertzjq Signed-off-by: Christian Brabandt diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2722,6 +2722,12 @@ ex_errmsg(char *msg, char_u *arg) } /* + * The "+" string used in place of an empty command in Ex mode. + * This string is used in pointer comparison. + */ +static char exmode_plus[] = "+"; + +/* * Handle a range without a command. * Returns an error message on failure. */ @@ -2730,7 +2736,8 @@ ex_range_without_command(exarg_T *eap) { char *errormsg = NULL; - if ((*eap->cmd == '|' || exmode_active) + if ((*eap->cmd == '|' || + (exmode_active && eap->cmd != (char_u *)exmode_plus + 1)) #ifdef FEAT_EVAL && !in_vim9script() #endif @@ -3212,7 +3219,7 @@ parse_command_modifiers( eap->cmd = orig_cmd; } else if (use_plus_cmd) - eap->cmd = (char_u *)"+"; + eap->cmd = (char_u *)exmode_plus; return OK; } diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim --- a/src/testdir/test_ex_mode.vim +++ b/src/testdir/test_ex_mode.vim @@ -68,7 +68,7 @@ func Test_Ex_substitute() CheckRunVimInTerminal let buf = RunVimInTerminal('', {'rows': 6}) - call term_sendkeys(buf, ":call setline(1, ['foo foo', 'foo foo', 'foo foo'])\") + call term_sendkeys(buf, ":call setline(1, repeat(['foo foo'], 4))\") call term_sendkeys(buf, ":set number\") call term_sendkeys(buf, "gQ") call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000) @@ -90,8 +90,14 @@ func Test_Ex_substitute() " Pressing enter in ex mode should print the current line call term_sendkeys(buf, "\") - call WaitForAssert({-> assert_match(' 3 foo foo', - \ term_getline(buf, 5))}, 1000) + call WaitForAssert({-> assert_match(' 3 foo foo', term_getline(buf, 5))}, 1000) + call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000) + + " The printed line should overwrite the colon + call term_sendkeys(buf, "\") + call WaitForAssert({-> assert_match(' 3 foo foo', term_getline(buf, 4))}, 1000) + call WaitForAssert({-> assert_match(' 4 foo foo', term_getline(buf, 5))}, 1000) + call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000) call term_sendkeys(buf, ":vi\") call WaitForAssert({-> assert_match('foo bar', term_getline(buf, 1))}, 1000) diff --git a/src/version.c b/src/version.c --- 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 */ /**/ + 582, +/**/ 581, /**/ 580,