summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-01 21:08:21 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-01 21:08:21 +0100
commited8bc78d2386d22656ba1d3e5cf739dd12964dce (patch)
tree5c54e4cac97c2f3608d8a7e948ceba74226c0788
parent2fb8f684d888ad68b283ba8f9505106b5fb725be (diff)
downloadvim-git-ed8bc78d2386d22656ba1d3e5cf739dd12964dce.tar.gz
patch 8.1.0556: saving/restoring search patterns share saved last_idxv8.1.0556
Problem: Saving/restoring search patterns share saved last_idx. Solution: Use a separate saved last_idx for saving search patterns for functions and incremental search.
-rw-r--r--src/search.c25
-rw-r--r--src/version.c2
2 files changed, 16 insertions, 11 deletions
diff --git a/src/search.c b/src/search.c
index 6d245caff..0cbbf4fef 100644
--- a/src/search.c
+++ b/src/search.c
@@ -93,12 +93,8 @@ static int lastc_bytelen = 1; /* >1 for multi-byte char */
/* copy of spats[], for keeping the search patterns while executing autocmds */
static struct spat saved_spats[2];
# ifdef FEAT_SEARCH_EXTRA
-/* copy of spats[RE_SEARCH], for keeping the search patterns while incremental
- * searching */
-static struct spat saved_last_search_spat;
-static int did_save_last_search_spat = 0;
-static int saved_last_idx = 0;
-static int saved_no_hlsearch = 0;
+static int saved_spats_last_idx = 0;
+static int saved_spats_no_hlsearch = 0;
# endif
static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */
@@ -310,8 +306,8 @@ save_search_patterns(void)
if (spats[1].pat != NULL)
saved_spats[1].pat = vim_strsave(spats[1].pat);
#ifdef FEAT_SEARCH_EXTRA
- saved_last_idx = last_idx;
- saved_no_hlsearch = no_hlsearch;
+ saved_spats_last_idx = last_idx;
+ saved_spats_no_hlsearch = no_hlsearch;
#endif
}
}
@@ -329,8 +325,8 @@ restore_search_patterns(void)
vim_free(spats[1].pat);
spats[1] = saved_spats[1];
#ifdef FEAT_SEARCH_EXTRA
- last_idx = saved_last_idx;
- set_no_hlsearch(saved_no_hlsearch);
+ last_idx = saved_spats_last_idx;
+ set_no_hlsearch(saved_spats_no_hlsearch);
#endif
}
}
@@ -354,6 +350,13 @@ free_search_patterns(void)
#endif
#ifdef FEAT_SEARCH_EXTRA
+// copy of spats[RE_SEARCH], for keeping the search patterns while incremental
+// searching
+static struct spat saved_last_search_spat;
+static int did_save_last_search_spat = 0;
+static int saved_last_idx = 0;
+static int saved_no_hlsearch = 0;
+
/*
* Save and restore the search pattern for incremental highlight search
* feature.
@@ -575,7 +578,7 @@ set_last_search_pat(
saved_spats[idx].pat = NULL;
else
saved_spats[idx].pat = vim_strsave(spats[idx].pat);
- saved_last_idx = last_idx;
+ saved_spats_last_idx = last_idx;
}
# ifdef FEAT_SEARCH_EXTRA
/* If 'hlsearch' set and search pat changed: need redraw. */
diff --git a/src/version.c b/src/version.c
index 566f94da5..55a9af65c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -793,6 +793,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 556,
+/**/
555,
/**/
554,