Fix the last line in the preview buffer

It would always show an empty line at the end that didn't belong.
This commit is contained in:
KillTheMule
2017-09-23 22:57:15 +02:00
parent 3e5ecd9538
commit d8bb1dabb6

View File

@@ -6177,7 +6177,11 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr,
// Put "|lnum| line" into `str` and append it to the preview buffer.
snprintf(str, line_size, "|%*ld| %s", col_width - 3,
next_linenr, line);
if (linenr_preview == 0) {
ml_replace(1, (char_u *)str, true);
} else {
ml_append(linenr_preview, (char_u *)str, (colnr_T)line_size, false);
}
linenr_preview += 1;
}
linenr_origbuf = match.end.lnum;