aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-07-13 08:32:17 +0800
committerGitHub <noreply@github.com>2023-07-13 08:32:17 +0800
commit0ce39108684ed7b6af03e47da0a4e0a022e41936 (patch)
tree4a9a5ac4e2b106784b0be62f8742e9ee0dd41f2d /src
parent9359701eae7bd8a59e4a916e085cc686f609d693 (diff)
downloadrneovim-0ce39108684ed7b6af03e47da0a4e0a022e41936.tar.gz
rneovim-0ce39108684ed7b6af03e47da0a4e0a022e41936.tar.bz2
rneovim-0ce39108684ed7b6af03e47da0a4e0a022e41936.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/charset.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index c2745a66a0..c6efb4b3b4 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -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;