forked from aniani/vim
updated for version 7.3.647
Problem: "gnd" doesn't work correctly in Visual mode. Solution: Handle Visual mode differently in "gn". (Christian Brabandt)
This commit is contained in:
11
src/search.c
11
src/search.c
@@ -4545,7 +4545,6 @@ current_search(count, forward)
|
|||||||
int dir;
|
int dir;
|
||||||
int result; /* result of various function calls */
|
int result; /* result of various function calls */
|
||||||
char_u old_p_ws = p_ws;
|
char_u old_p_ws = p_ws;
|
||||||
int visual_active = FALSE;
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
pos_T save_VIsual;
|
pos_T save_VIsual;
|
||||||
int zerowidth = FALSE;
|
int zerowidth = FALSE;
|
||||||
@@ -4561,11 +4560,6 @@ current_search(count, forward)
|
|||||||
{
|
{
|
||||||
orig_pos = curwin->w_cursor;
|
orig_pos = curwin->w_cursor;
|
||||||
save_VIsual = VIsual;
|
save_VIsual = VIsual;
|
||||||
visual_active = TRUE;
|
|
||||||
|
|
||||||
/* just started visual selection, only one character */
|
|
||||||
if (equalpos(VIsual, curwin->w_cursor))
|
|
||||||
visual_active = FALSE;
|
|
||||||
|
|
||||||
pos = curwin->w_cursor;
|
pos = curwin->w_cursor;
|
||||||
start_pos = VIsual;
|
start_pos = VIsual;
|
||||||
@@ -4619,7 +4613,7 @@ current_search(count, forward)
|
|||||||
p_ws = old_p_ws;
|
p_ws = old_p_ws;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
else if (!i && !result && !visual_active)
|
else if (!i && !result)
|
||||||
{
|
{
|
||||||
if (forward) /* try again from start of buffer */
|
if (forward) /* try again from start of buffer */
|
||||||
{
|
{
|
||||||
@@ -4692,6 +4686,7 @@ is_zerowidth(pattern)
|
|||||||
int nmatched = 0;
|
int nmatched = 0;
|
||||||
int result = -1;
|
int result = -1;
|
||||||
pos_T pos;
|
pos_T pos;
|
||||||
|
int save_called_emsg = called_emsg;
|
||||||
|
|
||||||
if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH,
|
if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH,
|
||||||
SEARCH_KEEP, ®match) == FAIL)
|
SEARCH_KEEP, ®match) == FAIL)
|
||||||
@@ -4704,6 +4699,7 @@ is_zerowidth(pattern)
|
|||||||
{
|
{
|
||||||
/* Zero-width pattern should match somewhere, then we can check if
|
/* Zero-width pattern should match somewhere, then we can check if
|
||||||
* start and end are in the same position. */
|
* start and end are in the same position. */
|
||||||
|
called_emsg = FALSE;
|
||||||
nmatched = vim_regexec_multi(®match, curwin, curbuf,
|
nmatched = vim_regexec_multi(®match, curwin, curbuf,
|
||||||
pos.lnum, (colnr_T)0, NULL);
|
pos.lnum, (colnr_T)0, NULL);
|
||||||
|
|
||||||
@@ -4713,6 +4709,7 @@ is_zerowidth(pattern)
|
|||||||
&& regmatch.startpos[0].col == regmatch.endpos[0].col);
|
&& regmatch.startpos[0].col == regmatch.endpos[0].col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
called_emsg |= save_called_emsg;
|
||||||
vim_free(regmatch.regprog);
|
vim_free(regmatch.regprog);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ gnd
|
|||||||
/\>\zs
|
/\>\zs
|
||||||
0gnd/^
|
0gnd/^
|
||||||
gnd$h/\zs
|
gnd$h/\zs
|
||||||
gnd
|
gnd/[u]niquepattern/s
|
||||||
|
vlgnd
|
||||||
:/^start:/,/^end:/wq! test.out
|
:/^start:/,/^end:/wq! test.out
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
|
||||||
@@ -67,4 +68,5 @@ join
|
|||||||
lines
|
lines
|
||||||
zero width pattern
|
zero width pattern
|
||||||
delete first and last chars
|
delete first and last chars
|
||||||
|
uniquepattern uniquepattern
|
||||||
end:
|
end:
|
||||||
|
|||||||
@@ -24,4 +24,5 @@ abcdx | | abcdx
|
|||||||
join lines
|
join lines
|
||||||
zerowidth pattern
|
zerowidth pattern
|
||||||
elete first and last char
|
elete first and last char
|
||||||
|
uniquepattern
|
||||||
end:
|
end:
|
||||||
|
|||||||
@@ -719,6 +719,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
647,
|
||||||
/**/
|
/**/
|
||||||
646,
|
646,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user