aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/decoration.c18
-rw-r--r--src/nvim/decoration.h3
-rw-r--r--src/nvim/drawline.c18
3 files changed, 22 insertions, 17 deletions
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c
index 265bc11661..0181cc8983 100644
--- a/src/nvim/decoration.c
+++ b/src/nvim/decoration.c
@@ -348,18 +348,12 @@ next_mark:
if (active && item.decor.spell != kNone) {
spell = item.decor.spell;
}
- if (item.start_row == state->row && decor_virt_pos(&item.decor)
- && item.draw_col != INT_MIN) {
- if (item.start_col <= col) {
- if (item.decor.virt_text_pos == kVTOverlay && item.draw_col == -1) {
- item.draw_col = (item.decor.virt_text_hide && hidden) ? INT_MIN : win_col;
- } else if (item.draw_col == -3) {
- item.draw_col = -1;
- }
- } else if (wp->w_p_wrap
- && (item.decor.virt_text_pos == kVTRightAlign
- || item.decor.virt_text_pos == kVTWinCol)) {
- item.draw_col = -3;
+ if (item.start_row == state->row && item.start_col <= col
+ && decor_virt_pos(&item.decor) && item.draw_col == -1) {
+ if (item.decor.virt_text_pos == kVTOverlay) {
+ item.draw_col = (item.decor.virt_text_hide && hidden) ? INT_MIN : win_col;
+ } else if (win_col < 0 && item.decor.virt_text_pos != kVTInline) {
+ item.draw_col = win_col;
}
}
if (keep) {
diff --git a/src/nvim/decoration.h b/src/nvim/decoration.h
index 3d16aa803e..dfd26294f3 100644
--- a/src/nvim/decoration.h
+++ b/src/nvim/decoration.h
@@ -84,7 +84,8 @@ typedef struct {
bool virt_text_owned;
/// Screen column to draw the virtual text.
/// When -1, the virtual text may be drawn after deciding where.
- /// When -3, the virtual text should be drawn on a later screen line.
+ /// When -2, the virtual text should be drawn at the start of the screen line.
+ /// When -3, the virtual text should be drawn on the next screen line.
/// When INT_MIN, the virtual text should no longer be drawn.
int draw_col;
uint64_t ns_id;
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index d0e31b41c3..b22699231d 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -282,6 +282,10 @@ static void draw_virt_text(win_T *wp, buf_T *buf, int col_off, int *end_col, int
} else if (item->decor.virt_text_pos == kVTWinCol) {
item->draw_col = MAX(item->decor.col + col_off, 0);
}
+ } else if (item->draw_col == -2) {
+ item->draw_col = col_off;
+ } else if (item->draw_col == -3) {
+ item->draw_col = item->decor.virt_text_pos == kVTOverlay ? -2 : -1;
}
if (item->draw_col < 0) {
continue;
@@ -3080,10 +3084,16 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
if (has_decor && (wp->w_p_rl ? (wlv.col < 0) : (wlv.col >= grid->cols))) {
// At the end of screen line: might need to peek for decorations just after
- // this position. Without wrapping, we might need to display win_col overlays
- // from the entire text line.
- colnr_T nextpos = wp->w_p_wrap ? (colnr_T)(ptr - line) : (colnr_T)strlen(line);
- decor_redraw_col(wp, nextpos, wlv.off, true, &decor_state);
+ // this position.
+ if (wp->w_p_wrap) {
+ // FIXME: virt_text_hide doesn't work for overlay virt_text at the next char
+ // as it's not easy to check if the next char is inside Visual selection.
+ decor_redraw_col(wp, (int)(ptr - line), -3, false, &decor_state);
+ } else {
+ // Without wrapping, we might need to display right_align and win_col
+ // virt_text for the entire text line.
+ decor_redraw_col(wp, MAXCOL, -1, true, &decor_state);
+ }
}
// At end of screen line and there is more to come: Display the line