Created
July 20, 2011 13:57
-
-
Save koron/1095002 to your computer and use it in GitHub Desktop.
make in_history() sensible of 'firstc' (vim)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ex_getln.c.orig 2011-07-20 22:35:22.540320700 +0900 | |
+++ ex_getln.c 2011-07-20 22:48:04.029204400 +0900 | |
@@ -67,7 +67,7 @@ | |
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 | |
static int calc_hist_idx __ARGS((int histype, int num)); | |
# endif | |
@@ -5306,10 +5306,11 @@ | |
* If 'move_to_front' is TRUE, matching entry is moved to end of history. | |
*/ | |
static int | |
-in_history(type, str, move_to_front) | |
+in_history(type, str, move_to_front, sep) | |
int type; | |
char_u *str; | |
int move_to_front; /* Move the entry to the front if it exists */ | |
+ int sep; | |
{ | |
int i; | |
int last_i = -1; | |
@@ -5323,6 +5324,13 @@ | |
return FALSE; | |
if (STRCMP(str, history[type][i].hisstr) == 0) | |
{ | |
+ char_u *p = history[type][i].hisstr; | |
+ | |
+ /* For search history, equation check includes first characters | |
+ * equation. */ | |
+ if (type == HIST_SEARCH && sep != p[STRLEN(p) + 1]) | |
+ break; | |
+ | |
if (!move_to_front) | |
return TRUE; | |
last_i = i; | |
@@ -5415,7 +5423,7 @@ | |
} | |
last_maptick = -1; | |
} | |
- if (!in_history(histype, new_entry, TRUE)) | |
+ if (!in_history(histype, new_entry, TRUE, sep)) | |
{ | |
if (++hisidx[histype] == hislen) | |
hisidx[histype] = 0; | |
@@ -5994,7 +6002,7 @@ | |
if (val != NULL && *val != NUL) | |
{ | |
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. */ | |
len = STRLEN(val); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment