Mercurial > vim
diff src/ex_cmds.c @ 533:c8b6b7e1005d v7.0150
updated for version 7.0150
author | vimboss |
---|---|
date | Sun, 25 Sep 2005 22:20:24 +0000 |
parents | da9142bd190a |
children | 862863033fdd |
line wrap: on
line diff
--- 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