Patch 7.3.265

瀏覽次數:29 次
跳到第一則未讀訊息

Bram Moolenaar

未讀,
2011年7月27日 上午11:58:582011/7/27
收件者:vim...@googlegroups.com

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 -- Br...@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 ///

回覆所有人
回覆作者
轉寄
0 則新訊息