1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: When storing a pattern in search history there is no proper check
12 for the separator character.
13 Solution: Pass the separator character to in_history(). (Muraoka Taro)
17 *** ../vim-7.3.264/src/ex_getln.c 2011-07-07 16:44:33.000000000 +0200
18 --- src/ex_getln.c 2011-07-27 17:50:35.000000000 +0200
22 static int hist_char2type __ARGS((int c));
24 ! static int in_history __ARGS((int, char_u *, int));
26 static int calc_hist_idx __ARGS((int histype, int num));
30 static int hist_char2type __ARGS((int c));
32 ! static int in_history __ARGS((int, char_u *, int, int));
34 static int calc_hist_idx __ARGS((int histype, int num));
38 * If 'move_to_front' is TRUE, matching entry is moved to end of history.
41 ! in_history(type, str, move_to_front)
44 int move_to_front; /* Move the entry to the front if it exists */
52 * If 'move_to_front' is TRUE, matching entry is moved to end of history.
55 ! in_history(type, str, move_to_front, sep)
58 int move_to_front; /* Move the entry to the front if it exists */
70 if (history[type][i].hisstr == NULL)
72 ! if (STRCMP(str, history[type][i].hisstr) == 0)
78 if (history[type][i].hisstr == NULL)
81 ! /* For search history, check that the separator character matches as
83 ! p = history[type][i].hisstr;
84 ! if (STRCMP(str, p) == 0
85 ! && (type != HIST_SEARCH || sep == p[STRLEN(p) + 1]))
94 ! if (!in_history(histype, new_entry, TRUE))
96 if (++hisidx[histype] == hislen)
102 ! if (!in_history(histype, new_entry, TRUE, sep))
104 if (++hisidx[histype] == hislen)
108 if (val != NULL && *val != NUL)
110 if (!in_history(type, val + (type == HIST_SEARCH),
111 ! viminfo_add_at_front))
113 /* Need to re-allocate to append the separator byte. */
116 if (val != NULL && *val != NUL)
118 if (!in_history(type, val + (type == HIST_SEARCH),
119 ! viminfo_add_at_front, *val))
121 /* Need to re-allocate to append the separator byte. */
123 *** ../vim-7.3.264/src/version.c 2011-07-27 17:31:42.000000000 +0200
124 --- src/version.c 2011-07-27 17:58:22.000000000 +0200
128 { /* Add new patch number below this line */
135 MORTICIAN: Who's that then?
136 CUSTOMER: I don't know.
137 MORTICIAN: Must be a king.
139 MORTICIAN: He hasn't got shit all over him.
140 The Quest for the Holy Grail (Monty Python)
142 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
143 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
144 \\\ an exciting new programming language -- http://www.Zimbu.org ///
145 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///