{
magic_T mymagic;
char_u *p = startp;
- size_t startplen = STRLEN(startp);
+ size_t startplen = 0;
if (magic)
mymagic = MAGIC_ON;
if (dirc == '?' && newp != NULL && p[1] == '?')
{
// change "\?" to "?", make a copy first.
+ if (startplen == 0)
+ startplen = STRLEN(startp);
if (*newp == NULL)
{
*newp = vim_strnsave(startp, startplen);
if (*newp != NULL)
+ {
p = *newp + (p - startp);
+ startp = *newp;
+ }
}
if (dropped != NULL)
++*dropped;
if (*newp != NULL)
- mch_memmove(p, p + 1, (startplen - ((p + 1) - *newp)) + 1);
+ mch_memmove(p, p + 1, startplen - ((p + 1) - startp) + 1);
else
++p;
}
close!
endfunc
-func Test_wrong_delimiter()
+" Test :g with ? as delimiter.
+func Test_global_question_delimiter()
+ new
+ call setline(1, ['aaaaa', 'b?bbb', 'ccccc', 'ddd?d', 'eeeee'])
+ g?\??delete
+ call assert_equal(['aaaaa', 'ccccc', 'eeeee'], getline(1, '$'))
+ bwipe!
+endfunc
+
+func Test_global_wrong_delimiter()
call assert_fails('g x^bxd', 'E146:')
endfunc
bwipe!
endfunc
-" Test :s with ? as separator.
-func Test_substitute_question_separator()
+" Test :s with ? as delimiter.
+func Test_substitute_question_delimiter()
new
call setline(1, '??:??')
%s?\?\??!!?g
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 438,
/**/
437,
/**/