mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
fix(extmarks): fix win_col virt_text drawn on wrong screen line (#25264)
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user