aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/drawline.c
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2023-12-26 00:16:03 +0100
committerGitHub <noreply@github.com>2023-12-26 07:16:03 +0800
commitbbd5c6363c25e8fbbfb962f8f6c5ea1800d431ca (patch)
tree85ba9d46cbe0d01a432f4bfb5f9ce475c0ee383f /src/nvim/drawline.c
parent0a598c13b1863ba1aff378027c4376e3ab7048ee (diff)
downloadrneovim-bbd5c6363c25e8fbbfb962f8f6c5ea1800d431ca.tar.gz
rneovim-bbd5c6363c25e8fbbfb962f8f6c5ea1800d431ca.tar.bz2
rneovim-bbd5c6363c25e8fbbfb962f8f6c5ea1800d431ca.zip
feat(extmarks): add virt_text_repeat_linebreak flag (#26625)
Problem: Unable to predict which byte-offset to place virtual text to make it repeat visually in the wrapped part of a line. Solution: Add a flag to nvim_buf_set_extmark() that causes virtual text to repeat in wrapped lines.
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r--src/nvim/drawline.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index de607e912f..885d308514 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -286,10 +286,12 @@ static void draw_virt_text(win_T *wp, buf_T *buf, int col_off, int *end_col, int
int vcol = item->draw_col - col_off;
col = draw_virt_text_item(buf, item->draw_col, vt->data.virt_text,
vt->hl_mode, max_col, vcol);
+ if (vt->pos == kVPosEndOfLine && do_eol) {
+ state->eol_col = col + 1;
+ }
}
- item->draw_col = INT_MIN; // deactivate
- if (vt && vt->pos == kVPosEndOfLine && do_eol) {
- state->eol_col = col + 1;
+ if (!vt || !(vt->flags & kVTRepeatLinebreak)) {
+ item->draw_col = INT_MIN; // deactivate
}
*end_col = MAX(*end_col, col);
@@ -1588,7 +1590,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
&& wlv.vcol >= wp->w_virtcol)
|| number_only)
&& wlv.filler_todo <= 0) {
- draw_virt_text(wp, buf, win_col_offset, &wlv.col, wlv.row);
+ if (!number_only) {
+ draw_virt_text(wp, buf, win_col_offset, &wlv.col, wlv.row);
+ }
// don't clear anything after wlv.col
win_put_linebuf(wp, wlv.row, 0, wlv.col, wlv.col, bg_attr, false);
// Pretend we have finished updating the window. Except when