diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-09-25 22:20:24 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-09-25 22:20:24 +0000 |
commit | 4463f296d0744915fa25dbd893821833043f9a25 (patch) | |
tree | 6fb51a6e33ab971e1a4f90dee47683788fc3d1ce /src/ex_cmds.c | |
parent | 1e01546026ce909b5fe56c05867f28e77d1b6eb3 (diff) | |
download | vim-git-4463f296d0744915fa25dbd893821833043f9a25.tar.gz |
updated for version 7.0150v7.0150
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index c35ad3862..84c5b49f2 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -4520,6 +4520,14 @@ do_sub(eap) sublen = vim_regsub_multi(®match, sub_firstlnum, sub, sub_firstline, FALSE, p_magic, TRUE); + /* When the match included the "$" of the last line it may + * include one line too much. */ + if (nmatch > curbuf->b_ml.ml_line_count - sub_firstlnum + 1) + { + nmatch = curbuf->b_ml.ml_line_count - sub_firstlnum + 1; + skip_match = TRUE; + } + /* Need room for: * - result so far in new_start (not for first sub in line) * - original text up to match |