summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorK.Takata <kentkt@csc.jp>2023-02-10 21:38:44 +0000
committerBram Moolenaar <Bram@vim.org>2023-02-10 21:38:44 +0000
commitc4b7dec38292fe1cfad7aa5f244031fc6f7c7a09 (patch)
treeba46891cd829d6d5ebd640ea74e51b7ef1528190 /src/ex_getln.c
parent962d91643520ec3748fcf5af3263d89ccfcdda92 (diff)
patch 9.0.1298: inserting register on the cmdline does not trigger incsearchv9.0.1298
Problem: Inserting a register on the command line does not trigger incsearch or update hlsearch. Solution: Have cmdline_insert_reg() return CMDLINE_CHANGED when appropriate and handle it correctly. (Ken Takata, closes #11960)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 6d0b3c5db6..d40f923382 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1183,6 +1183,7 @@ cmdline_insert_reg(int *gotesc UNUSED)
{
int i;
int c;
+ int literally = FALSE;
#ifdef FEAT_EVAL
int save_new_cmdpos = new_cmdpos;
#endif
@@ -1220,7 +1221,8 @@ cmdline_insert_reg(int *gotesc UNUSED)
#endif
if (c != ESC) // use ESC to cancel inserting register
{
- cmdline_paste(c, i == Ctrl_R, FALSE);
+ literally = i == Ctrl_R;
+ cmdline_paste(c, literally, FALSE);
#ifdef FEAT_EVAL
// When there was a serious error abort getting the
@@ -1251,8 +1253,9 @@ cmdline_insert_reg(int *gotesc UNUSED)
// remove the double quote
redrawcmd();
- // The text has been stuffed, the command line didn't change yet.
- return CMDLINE_NOT_CHANGED;
+ // The text has been stuffed, the command line didn't change yet, but it
+ // will change soon. The caller must take care of it.
+ return literally ? CMDLINE_NOT_CHANGED : CMDLINE_CHANGED;
}
/*
@@ -2081,11 +2084,13 @@ getcmdline_int(
case Ctrl_R: // insert register
res = cmdline_insert_reg(&gotesc);
- if (res == CMDLINE_NOT_CHANGED)
- goto cmdline_not_changed;
- else if (res == GOTO_NORMAL_MODE)
+ if (res == GOTO_NORMAL_MODE)
goto returncmd;
- goto cmdline_changed;
+#ifdef FEAT_SEARCH_EXTRA
+ if (res == CMDLINE_NOT_CHANGED)
+ is_state.incsearch_postponed = TRUE;
+#endif
+ goto cmdline_not_changed;
case Ctrl_D:
if (showmatches(&xpc, FALSE) == EXPAND_NOTHING)