0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.0887: the 'l' flag in :subsitute is sticky

Problem:    The 'l' flag in :subsitute is sticky.
Solution:   Reset the flag. (Dominique Pelle, closes #3925)
This commit is contained in:
Bram Moolenaar
2019-02-10 21:55:26 +01:00
parent b763361161
commit 9474716d39
3 changed files with 30 additions and 1 deletions

View File

@@ -2098,7 +2098,7 @@ write_viminfo(char_u *file, int forceit)
fp_out = NULL; fp_out = NULL;
# ifdef EEXIST # ifdef EEXIST
/* Avoid trying lots of names while the problem is lack /* Avoid trying lots of names while the problem is lack
* of premission, only retry if the file already * of permission, only retry if the file already
* exists. */ * exists. */
if (errno != EEXIST) if (errno != EEXIST)
break; break;
@@ -5040,6 +5040,7 @@ do_sub(exarg_T *eap)
} }
subflags.do_error = TRUE; subflags.do_error = TRUE;
subflags.do_print = FALSE; subflags.do_print = FALSE;
subflags.do_list = FALSE;
subflags.do_count = FALSE; subflags.do_count = FALSE;
subflags.do_number = FALSE; subflags.do_number = FALSE;
subflags.do_ic = 0; subflags.do_ic = 0;

View File

@@ -107,6 +107,32 @@ func Test_substitute_variants()
endfor endfor
endfunc endfunc
" Test the l, p, # flags.
func Test_substitute_flags_lp()
new
call setline(1, "abc\tdef\<C-h>ghi")
let a = execute('s/a/a/p')
call assert_equal("\nabc def^Hghi", a)
let a = execute('s/a/a/l')
call assert_equal("\nabc^Idef^Hghi$", a)
let a = execute('s/a/a/#')
call assert_equal("\n 1 abc def^Hghi", a)
let a = execute('s/a/a/p#')
call assert_equal("\n 1 abc def^Hghi", a)
let a = execute('s/a/a/l#')
call assert_equal("\n 1 abc^Idef^Hghi$", a)
let a = execute('s/a/a/')
call assert_equal("", a)
bwipe!
endfunc
func Test_substitute_repeat() func Test_substitute_repeat()
" This caused an invalid memory access. " This caused an invalid memory access.
split Xfile split Xfile

View File

@@ -783,6 +783,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 */
/**/
887,
/**/ /**/
886, 886,
/**/ /**/