aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2018-01-21 15:09:17 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2018-01-26 18:39:20 +0300
commit9bc1410ee1a467a8058a8de585c0e68d64ef8521 (patch)
tree14d26e2579dae05b595c5ff3b8fdf58b7b925845 /src
parentcd59577d576d71aa788a873ce779ce6dc3e7bc21 (diff)
downloadrneovim-9bc1410ee1a467a8058a8de585c0e68d64ef8521.tar.gz
rneovim-9bc1410ee1a467a8058a8de585c0e68d64ef8521.tar.bz2
rneovim-9bc1410ee1a467a8058a8de585c0e68d64ef8521.zip
vim-patch:8.0.1304: CTRL-G/CTRL-T don't work with incsearch and empty pattern
Problem: CTRL-G/CTRL-T don't work with incsearch and empty pattern. Solution: Use the last search pattern. (Christian Brabandt, closes vim/vim#2292) https://github.com/vim/vim/commit/d0480097177369a6ed91d47aba189ae647afcd68
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c11
-rw-r--r--src/nvim/search.c6
-rw-r--r--src/nvim/version.c2
3 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index e396a179a1..2178505874 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1019,7 +1019,16 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match)
ui_flush();
pos_T t;
+ char_u *pat;
int search_flags = SEARCH_NOOF;
+
+
+ if (s->firstc == ccline.cmdbuff[0]) {
+ pat = last_search_pattern();
+ } else {
+ pat = ccline.cmdbuff;
+ }
+
save_last_search_pattern();
if (next_match) {
@@ -1039,7 +1048,7 @@ static void command_line_next_incsearch(CommandLineState *s, bool next_match)
emsg_off++;
s->i = searchit(curwin, curbuf, &t,
next_match ? FORWARD : BACKWARD,
- ccline.cmdbuff, s->count, search_flags,
+ pat, s->count, search_flags,
RE_SEARCH, 0, NULL);
emsg_off--;
ui_busy_stop();
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 89a7752e9f..9ae5754f80 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -335,6 +335,12 @@ restore_last_search_pattern(void)
SET_NO_HLSEARCH(saved_no_hlsearch);
}
+ char_u *
+last_search_pattern(void)
+{
+ return spats[RE_SEARCH].pat;
+}
+
/*
* Return TRUE when case should be ignored for search pattern "pat".
* Uses the 'ignorecase' and 'smartcase' options.
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 370c8ab5d3..ba2912ef29 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -193,7 +193,7 @@ static const int included_patches[] = {
// 1307,
// 1306,
// 1305,
- // 1304,
+ 1304,
// 1303,
// 1302,
// 1301,