mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
fix(ui): cursor pos with left gravity inline virt_text at eol (#24329)
Problem: Cursor is not after inline virtual text with left gravity when inserting after the end of the line. Solution: Add width of inline virtual text with left gravity to cursor virtcol in Insert mode even if on a NUL.
This commit is contained in:
@@ -1089,12 +1089,11 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en
|
||||
// cursor at end
|
||||
*cursor = vcol + incr - 1;
|
||||
} else {
|
||||
if (!on_NUL) {
|
||||
// cursor is after inserted text, unless on the NUL
|
||||
if (!on_NUL || !(State & MODE_NORMAL)) {
|
||||
vcol += cts.cts_cur_text_width_left;
|
||||
if ((State & MODE_INSERT) == 0) {
|
||||
vcol += cts.cts_cur_text_width_right;
|
||||
}
|
||||
}
|
||||
if (!on_NUL && (State & MODE_NORMAL)) {
|
||||
vcol += cts.cts_cur_text_width_right;
|
||||
}
|
||||
// cursor at start
|
||||
*cursor = vcol + head;
|
||||
|
Reference in New Issue
Block a user