aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKillTheMule <KillTheMule@users.noreply.github.com>2017-09-23 22:57:15 +0200
committerKillTheMule <KillTheMule@users.noreply.github.com>2017-10-29 18:11:32 +0100
commitd8bb1dabb63501fe4075f062d4ed81bbc62170d0 (patch)
tree3c6554c8beb7a4a0d8ca4ea052a416fab084b4df
parent3e5ecd95386da2122e495ed4fda566f6e1997206 (diff)
downloadrneovim-d8bb1dabb63501fe4075f062d4ed81bbc62170d0.tar.gz
rneovim-d8bb1dabb63501fe4075f062d4ed81bbc62170d0.tar.bz2
rneovim-d8bb1dabb63501fe4075f062d4ed81bbc62170d0.zip
Fix the last line in the preview buffer
It would always show an empty line at the end that didn't belong.
-rw-r--r--src/nvim/ex_cmds.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index b74aad46bf..b9f14f27ea 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -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);
- ml_append(linenr_preview, (char_u *)str, (colnr_T)line_size, false);
+ 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;