0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.2.408

Problem:    With ":g/the/s/foo/bar/" the '[ and '] marks can be set to a line
            that was not changed.
Solution:   Only set '[ and '] marks when a substitution was done.
This commit is contained in:
Bram Moolenaar
2010-03-23 17:36:29 +01:00
parent 06975a4a98
commit 46475520d7
2 changed files with 5 additions and 1 deletions

View File

@@ -4238,6 +4238,7 @@ do_sub(eap)
char_u *sub_firstline; /* allocated copy of first sub line */ char_u *sub_firstline; /* allocated copy of first sub line */
int endcolumn = FALSE; /* cursor in last column when done */ int endcolumn = FALSE; /* cursor in last column when done */
pos_T old_cursor = curwin->w_cursor; pos_T old_cursor = curwin->w_cursor;
int start_nsubs;
cmd = eap->arg; cmd = eap->arg;
if (!global_busy) if (!global_busy)
@@ -4245,6 +4246,7 @@ do_sub(eap)
sub_nsubs = 0; sub_nsubs = 0;
sub_nlines = 0; sub_nlines = 0;
} }
start_nsubs = sub_nsubs;
if (eap->cmdidx == CMD_tilde) if (eap->cmdidx == CMD_tilde)
which_pat = RE_LAST; /* use last used regexp */ which_pat = RE_LAST; /* use last used regexp */
@@ -5106,7 +5108,7 @@ outofmem:
if (do_count) if (do_count)
curwin->w_cursor = old_cursor; curwin->w_cursor = old_cursor;
if (sub_nsubs) if (sub_nsubs > start_nsubs)
{ {
/* Set the '[ and '] marks. */ /* Set the '[ and '] marks. */
curbuf->b_op_start.lnum = eap->line1; curbuf->b_op_start.lnum = eap->line1;

View File

@@ -681,6 +681,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 */
/**/
408,
/**/ /**/
407, 407,
/**/ /**/