Compare commits

...

4 Commits

Author SHA1 Message Date
Bram Moolenaar
d25bc23870 updated for version 7.2.409
Problem:    Summary of number of substitutes is incorrect for ":folddo". (Jean
            Johner)
Solution:   Reset sub_nsubs and sub_nlines in global_exe().
2010-03-23 17:49:24 +01:00
Bram Moolenaar
46475520d7 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.
2010-03-23 17:36:29 +01:00
Bram Moolenaar
06975a4a98 updated for version 7.2.407
Problem:    When using an expression in ":s" backslashes in the result are
            dropped. (Sergey Goldgaber, Christian Brabandt)
Solution:   Double backslashes.
2010-03-23 16:27:22 +01:00
Bram Moolenaar
70c49c1af4 updated for version 7.2.406
Problem:    Patch 7.2.119 introduces uninit mem read. (Dominique Pelle)
Solution:   Only used ScreeenLinesC when ScreeenLinesUC is not zero. (Yukihiro
            Nakadaira)  Also clear ScreeenLinesC when allocating.
2010-03-23 15:36:35 +01:00
4 changed files with 39 additions and 9 deletions

View File

@@ -4238,6 +4238,7 @@ do_sub(eap)
char_u *sub_firstline; /* allocated copy of first sub line */
int endcolumn = FALSE; /* cursor in last column when done */
pos_T old_cursor = curwin->w_cursor;
int start_nsubs;
cmd = eap->arg;
if (!global_busy)
@@ -4245,6 +4246,7 @@ do_sub(eap)
sub_nsubs = 0;
sub_nlines = 0;
}
start_nsubs = sub_nsubs;
if (eap->cmdidx == CMD_tilde)
which_pat = RE_LAST; /* use last used regexp */
@@ -5106,7 +5108,7 @@ outofmem:
if (do_count)
curwin->w_cursor = old_cursor;
if (sub_nsubs)
if (sub_nsubs > start_nsubs)
{
/* Set the '[ and '] marks. */
curbuf->b_op_start.lnum = eap->line1;
@@ -5236,8 +5238,6 @@ ex_global(eap)
type = *eap->cmd;
cmd = eap->arg;
which_pat = RE_LAST; /* default: use last used regexp */
sub_nsubs = 0;
sub_nlines = 0;
/*
* undocumented vi feature:
@@ -5341,6 +5341,8 @@ global_exe(cmd)
/* When the command writes a message, don't overwrite the command. */
msg_didout = TRUE;
sub_nsubs = 0;
sub_nlines = 0;
global_need_beginline = FALSE;
global_busy = 1;
old_lcount = curbuf->b_ml.ml_line_count;

View File

@@ -6963,6 +6963,8 @@ vim_regsub_both(source, dest, copy, magic, backslash)
eval_result = eval_to_string(source + 2, NULL, TRUE);
if (eval_result != NULL)
{
int had_backslash = FALSE;
for (s = eval_result; *s != NUL; mb_ptr_adv(s))
{
/* Change NL to CR, so that it becomes a line break.
@@ -6970,7 +6972,20 @@ vim_regsub_both(source, dest, copy, magic, backslash)
if (*s == NL)
*s = CAR;
else if (*s == '\\' && s[1] != NUL)
{
++s;
had_backslash = TRUE;
}
}
if (had_backslash && backslash)
{
/* Backslashes will be consumed, need to double them. */
s = vim_strsave_escaped(eval_result, (char_u *)"\\");
if (s != NULL)
{
vim_free(eval_result);
eval_result = s;
}
}
dst += STRLEN(eval_result);

View File

@@ -25,10 +25,11 @@
* one character which occupies two display cells.
* For UTF-8 a multi-byte character is converted to Unicode and stored in
* ScreenLinesUC[]. ScreenLines[] contains the first byte only. For an ASCII
* character without composing chars ScreenLinesUC[] will be 0. When the
* character occupies two display cells the next byte in ScreenLines[] is 0.
* character without composing chars ScreenLinesUC[] will be 0 and
* ScreenLinesC[][] is not used. When the character occupies two display
* cells the next byte in ScreenLines[] is 0.
* ScreenLinesC[][] contain up to 'maxcombine' composing characters
* (drawn on top of the first character). They are 0 when not used.
* (drawn on top of the first character). There is 0 after the last one used.
* ScreenLines2[] is only used for euc-jp to store the second byte if the
* first byte is 0x8e (single-width character).
*
@@ -4893,6 +4894,7 @@ static int comp_char_differs __ARGS((int, int));
/*
* Return if the composing characters at "off_from" and "off_to" differ.
* Only to be used when ScreenLinesUC[off_from] != 0.
*/
static int
comp_char_differs(off_from, off_to)
@@ -6281,6 +6283,7 @@ static int screen_comp_differs __ARGS((int, int*));
/*
* Return TRUE if composing characters for screen posn "off" differs from
* composing characters in "u8cc".
* Only to be used when ScreenLinesUC[off] != 0.
*/
static int
screen_comp_differs(off, u8cc)
@@ -6461,8 +6464,10 @@ screen_puts_len(text, len, row, col, attr)
&& c == 0x8e
&& ScreenLines2[off] != ptr[1])
|| (enc_utf8
&& (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
|| screen_comp_differs(off, u8cc)))
&& (ScreenLinesUC[off] !=
(u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c)
|| (ScreenLinesUC[off] != 0
&& screen_comp_differs(off, u8cc))))
#endif
|| ScreenAttrs[off] != attr
|| exmode_active;
@@ -7542,7 +7547,7 @@ retry:
new_ScreenLinesUC = (u8char_T *)lalloc((long_u)(
(Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
for (i = 0; i < p_mco; ++i)
new_ScreenLinesC[i] = (u8char_T *)lalloc((long_u)(
new_ScreenLinesC[i] = (u8char_T *)lalloc_clear((long_u)(
(Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
}
if (enc_dbcs == DBCS_JPNU)

View File

@@ -681,6 +681,14 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
409,
/**/
408,
/**/
407,
/**/
406,
/**/
405,
/**/