@@ -67,7 +67,7 @@ static int hislen = 0; /* actual length of history tables */
6767
6868static int hist_char2type __ARGS ((int c ));
6969
70- static int in_history __ARGS ((int , char_u * , int ));
70+ static int in_history __ARGS ((int , char_u * , int , int ));
7171# ifdef FEAT_EVAL
7272static int calc_hist_idx __ARGS ((int histype , int num ));
7373# endif
@@ -5306,10 +5306,11 @@ init_history()
53065306 * If 'move_to_front' is TRUE, matching entry is moved to end of history.
53075307 */
53085308 static int
5309- in_history (type , str , move_to_front )
5309+ in_history (type , str , move_to_front , sep )
53105310 int type ;
53115311 char_u * str ;
53125312 int move_to_front ; /* Move the entry to the front if it exists */
5313+ int sep ;
53135314{
53145315 int i ;
53155316 int last_i = -1 ;
@@ -5323,6 +5324,13 @@ in_history(type, str, move_to_front)
53235324 return FALSE;
53245325 if (STRCMP (str , history [type ][i ].hisstr ) == 0 )
53255326 {
5327+ char_u * p = history [type ][i ].hisstr ;
5328+
5329+ /* For search history, equation check includes first characters
5330+ * equation. */
5331+ if (type == HIST_SEARCH && sep != p [STRLEN (p ) + 1 ])
5332+ break ;
5333+
53265334 if (!move_to_front )
53275335 return TRUE;
53285336 last_i = i ;
@@ -5415,7 +5423,7 @@ add_to_history(histype, new_entry, in_map, sep)
54155423 }
54165424 last_maptick = -1 ;
54175425 }
5418- if (!in_history (histype , new_entry , TRUE))
5426+ if (!in_history (histype , new_entry , TRUE, sep ))
54195427 {
54205428 if (++ hisidx [histype ] == hislen )
54215429 hisidx [histype ] = 0 ;
@@ -5994,7 +6002,7 @@ read_viminfo_history(virp)
59946002 if (val != NULL && * val != NUL )
59956003 {
59966004 if (!in_history (type , val + (type == HIST_SEARCH ),
5997- viminfo_add_at_front ))
6005+ viminfo_add_at_front , * val ))
59986006 {
59996007 /* Need to re-allocate to append the separator byte. */
60006008 len = STRLEN (val );
0 commit comments