Merge pull request #1533 from elmart/fix-sub-newline-abort

Fix newline substitution causing abort
This commit is contained in:
Justin M. Keyes 2014-11-28 15:38:22 -05:00
commit 371594fe9a

View File

@ -3602,8 +3602,13 @@ void do_sub(exarg_T *eap)
eap->flags = EXFLAG_PRINT; eap->flags = EXFLAG_PRINT;
} }
do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE, true); linenr_T joined_lines_count = eap->line2 < curbuf->b_ml.ml_line_count
sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1; ? eap->line2 - eap->line1 + 2
: eap->line2 - eap->line1 + 1;
if (joined_lines_count >= 2) {
do_join(joined_lines_count, FALSE, TRUE, FALSE, true);
}
sub_nlines = sub_nsubs = joined_lines_count - 1;
do_sub_msg(false); do_sub_msg(false);
ex_may_print(eap); ex_may_print(eap);