summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-09-25 22:20:24 +0000
committerBram Moolenaar <Bram@vim.org>2005-09-25 22:20:24 +0000
commit4463f296d0744915fa25dbd893821833043f9a25 (patch)
tree6fb51a6e33ab971e1a4f90dee47683788fc3d1ce /src/ex_cmds.c
parent1e01546026ce909b5fe56c05867f28e77d1b6eb3 (diff)
updated for version 7.0150v7.0150
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index c35ad38622..84c5b49f27 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4520,6 +4520,14 @@ do_sub(eap)
sublen = vim_regsub_multi(&regmatch, 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