forked from aniani/vim
updated for version 7.3.265
Problem: When storing a pattern in search history there is no proper check
for the separator character.
Solution: Pass the separator character to in_history(). (Muraoka Taro)
This commit is contained in:
@@ -67,7 +67,7 @@ static int hislen = 0; /* actual length of history tables */
|
|||||||
|
|
||||||
static int hist_char2type __ARGS((int c));
|
static int hist_char2type __ARGS((int c));
|
||||||
|
|
||||||
static int in_history __ARGS((int, char_u *, int));
|
static int in_history __ARGS((int, char_u *, int, int));
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
static int calc_hist_idx __ARGS((int histype, int num));
|
static int calc_hist_idx __ARGS((int histype, int num));
|
||||||
# endif
|
# endif
|
||||||
@@ -5289,13 +5289,15 @@ init_history()
|
|||||||
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
|
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
in_history(type, str, move_to_front)
|
in_history(type, str, move_to_front, sep)
|
||||||
int type;
|
int type;
|
||||||
char_u *str;
|
char_u *str;
|
||||||
int move_to_front; /* Move the entry to the front if it exists */
|
int move_to_front; /* Move the entry to the front if it exists */
|
||||||
|
int sep;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int last_i = -1;
|
int last_i = -1;
|
||||||
|
char_u *p;
|
||||||
|
|
||||||
if (hisidx[type] < 0)
|
if (hisidx[type] < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -5304,7 +5306,12 @@ in_history(type, str, move_to_front)
|
|||||||
{
|
{
|
||||||
if (history[type][i].hisstr == NULL)
|
if (history[type][i].hisstr == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (STRCMP(str, history[type][i].hisstr) == 0)
|
|
||||||
|
/* For search history, check that the separator character matches as
|
||||||
|
* well. */
|
||||||
|
p = history[type][i].hisstr;
|
||||||
|
if (STRCMP(str, p) == 0
|
||||||
|
&& (type != HIST_SEARCH || sep == p[STRLEN(p) + 1]))
|
||||||
{
|
{
|
||||||
if (!move_to_front)
|
if (!move_to_front)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -5398,7 +5405,7 @@ add_to_history(histype, new_entry, in_map, sep)
|
|||||||
}
|
}
|
||||||
last_maptick = -1;
|
last_maptick = -1;
|
||||||
}
|
}
|
||||||
if (!in_history(histype, new_entry, TRUE))
|
if (!in_history(histype, new_entry, TRUE, sep))
|
||||||
{
|
{
|
||||||
if (++hisidx[histype] == hislen)
|
if (++hisidx[histype] == hislen)
|
||||||
hisidx[histype] = 0;
|
hisidx[histype] = 0;
|
||||||
@@ -5977,7 +5984,7 @@ read_viminfo_history(virp)
|
|||||||
if (val != NULL && *val != NUL)
|
if (val != NULL && *val != NUL)
|
||||||
{
|
{
|
||||||
if (!in_history(type, val + (type == HIST_SEARCH),
|
if (!in_history(type, val + (type == HIST_SEARCH),
|
||||||
viminfo_add_at_front))
|
viminfo_add_at_front, *val))
|
||||||
{
|
{
|
||||||
/* Need to re-allocate to append the separator byte. */
|
/* Need to re-allocate to append the separator byte. */
|
||||||
len = STRLEN(val);
|
len = STRLEN(val);
|
||||||
|
|||||||
@@ -709,6 +709,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
265,
|
||||||
/**/
|
/**/
|
||||||
264,
|
264,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user