diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-20 21:48:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 21:48:12 +0800 |
commit | 818d7f6daf306c6ad7bed0d2ee5c8b9c89f625f4 (patch) | |
tree | ed6ec970b2ecfd92cb73950aef3b373709540ce8 /src | |
parent | 877d04d0fb83b5fc602dbab22b58f26a793ec236 (diff) | |
download | rneovim-818d7f6daf306c6ad7bed0d2ee5c8b9c89f625f4.tar.gz rneovim-818d7f6daf306c6ad7bed0d2ee5c8b9c89f625f4.tar.bz2 rneovim-818d7f6daf306c6ad7bed0d2ee5c8b9c89f625f4.zip |
fix(extmarks): fix win_col virt_text drawn on wrong screen line (#25264)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/decoration.c | 9 | ||||
-rw-r--r-- | src/nvim/decoration.h | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c index f4ca31040a..b70f070a51 100644 --- a/src/nvim/decoration.c +++ b/src/nvim/decoration.c @@ -254,7 +254,7 @@ static void decor_add(DecorState *state, int start_row, int start_col, int end_r DecorRange range = { start_row, start_col, end_row, end_col, *decor, attr_id, - kv_size(decor->virt_text) && owned, -1, ns_id, mark_id }; + kv_size(decor->virt_text) && owned, -10, ns_id, mark_id }; kv_pushp(state->active); size_t index; @@ -268,10 +268,10 @@ static void decor_add(DecorState *state, int start_row, int start_col, int end_r kv_A(state->active, index) = range; } -/// Initialize the draw_col of a newly-added non-inline virtual text item. +/// Initialize the draw_col of a newly-added virtual text item. static void decor_init_draw_col(int win_col, bool hidden, DecorRange *item) { - if (win_col < 0) { + if (win_col < 0 && item->decor.virt_text_pos != kVTInline) { item->draw_col = win_col; } else if (item->decor.virt_text_pos == kVTOverlay) { item->draw_col = (item->decor.virt_text_hide && hidden) ? INT_MIN : win_col; @@ -371,8 +371,7 @@ next_mark: spell = item.decor.spell; } if (item.start_row == state->row && item.start_col <= col - && decor_virt_pos(&item.decor) && item.draw_col == -1 - && item.decor.virt_text_pos != kVTInline) { + && decor_virt_pos(&item.decor) && item.draw_col == -10) { decor_init_draw_col(win_col, hidden, &item); } if (keep) { diff --git a/src/nvim/decoration.h b/src/nvim/decoration.h index 0f191aa870..fef5ff7c2a 100644 --- a/src/nvim/decoration.h +++ b/src/nvim/decoration.h @@ -85,6 +85,7 @@ typedef struct { /// 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 the next screen line. + /// When -10, the virtual text has just been added. /// When INT_MIN, the virtual text should no longer be drawn. int draw_col; uint64_t ns_id; |