0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 9.0.0297: cursor position wrong after right aligned virtual text

Problem:    Cursor position wrong after right aligned virtual text. (Iizuka
            Masashi)
Solution:   Take the width of the column offset into account. (closes #10997)
            Also fix virtual text positioning.
This commit is contained in:
Bram Moolenaar
2022-08-28 16:39:22 +01:00
parent 35a4fbc5d0
commit c8bf59e9b2
5 changed files with 25 additions and 9 deletions

View File

@@ -302,6 +302,7 @@ text_prop_position(
int padding = tp->tp_col == MAXCOL && tp->tp_len > 1
? tp->tp_len - 1 : 0;
int col_with_padding = vcol + (below ? 0 : padding);
int col_off = 0;
int room = wp->w_width - col_with_padding;
int added = room;
int n_used = *n_extra;
@@ -324,7 +325,8 @@ text_prop_position(
if (right && (wrap || room < PROP_TEXT_MIN_CELLS))
{
// right-align on next line instead of wrapping if possible
added = wp->w_width - strsize + room;
col_off = win_col_off(wp) + win_col_off2(wp);
added = wp->w_width - col_off - strsize + room;
if (added < 0)
added = 0;
else
@@ -386,7 +388,7 @@ text_prop_position(
*p_extra = l;
*n_extra = n_used + added + padding;
*n_attr = mb_charlen(*p_extra);
*n_attr_skip = added + padding;
*n_attr_skip = added + padding + col_off;
}
}
}