1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
To: vim_dev@googlegroups.com
Subject: Patch 7.3.265
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 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)
Files: src/ex_getln.c
*** ../vim-7.3.264/src/ex_getln.c 2011-07-07 16:44:33.000000000 +0200
--- src/ex_getln.c 2011-07-27 17:50:35.000000000 +0200
***************
*** 67,73 ****
static int hist_char2type __ARGS((int c));
! static int in_history __ARGS((int, char_u *, int));
# ifdef FEAT_EVAL
static int calc_hist_idx __ARGS((int histype, int num));
# endif
--- 67,73 ----
static int hist_char2type __ARGS((int c));
! static int in_history __ARGS((int, char_u *, int, int));
# ifdef FEAT_EVAL
static int calc_hist_idx __ARGS((int histype, int num));
# endif
***************
*** 5289,5301 ****
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
*/
static int
! in_history(type, str, move_to_front)
int type;
char_u *str;
int move_to_front; /* Move the entry to the front if it exists */
{
int i;
int last_i = -1;
if (hisidx[type] < 0)
return FALSE;
--- 5289,5303 ----
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
*/
static int
! 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;
+ char_u *p;
if (hisidx[type] < 0)
return FALSE;
***************
*** 5304,5310 ****
{
if (history[type][i].hisstr == NULL)
return FALSE;
! if (STRCMP(str, history[type][i].hisstr) == 0)
{
if (!move_to_front)
return TRUE;
--- 5306,5317 ----
{
if (history[type][i].hisstr == NULL)
return FALSE;
!
! /* 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)
return TRUE;
***************
*** 5398,5404 ****
}
last_maptick = -1;
}
! if (!in_history(histype, new_entry, TRUE))
{
if (++hisidx[histype] == hislen)
hisidx[histype] = 0;
--- 5405,5411 ----
}
last_maptick = -1;
}
! if (!in_history(histype, new_entry, TRUE, sep))
{
if (++hisidx[histype] == hislen)
hisidx[histype] = 0;
***************
*** 5977,5983 ****
if (val != NULL && *val != NUL)
{
if (!in_history(type, val + (type == HIST_SEARCH),
! viminfo_add_at_front))
{
/* Need to re-allocate to append the separator byte. */
len = STRLEN(val);
--- 5984,5990 ----
if (val != NULL && *val != NUL)
{
if (!in_history(type, val + (type == HIST_SEARCH),
! viminfo_add_at_front, *val))
{
/* Need to re-allocate to append the separator byte. */
len = STRLEN(val);
*** ../vim-7.3.264/src/version.c 2011-07-27 17:31:42.000000000 +0200
--- src/version.c 2011-07-27 17:58:22.000000000 +0200
***************
*** 711,712 ****
--- 711,714 ----
{ /* Add new patch number below this line */
+ /**/
+ 265,
/**/
--
[clop clop]
MORTICIAN: Who's that then?
CUSTOMER: I don't know.
MORTICIAN: Must be a king.
CUSTOMER: Why?
MORTICIAN: He hasn't got shit all over him.
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|