aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/charset.c
diff options
context:
space:
mode:
authorIbby <33922797+SleepySwords@users.noreply.github.com>2023-03-26 16:09:09 +1100
committerbfredl <bjorn.linse@gmail.com>2023-05-22 13:49:42 +0200
commitdee3af2122d5072d351551ef023d2c177334b332 (patch)
treec54d0d7c45c1ca37e3632d58668fe3c6a31fcd7b /src/nvim/charset.c
parent43c2eaada220d5e7d44fa9086655b00ee3e5fbb5 (diff)
downloadrneovim-dee3af2122d5072d351551ef023d2c177334b332.tar.gz
rneovim-dee3af2122d5072d351551ef023d2c177334b332.tar.bz2
rneovim-dee3af2122d5072d351551ef023d2c177334b332.zip
vim-patch:9.0.0178: cursor position wrong with virtual text before Tab
Problem: Cursor position wrong with virtual text before Tab. Solution: Use the byte length, not the cell with, to compare the column. Correct tab size after text prop. (closes vim/vim#10866) https://github.com/vim/vim/commit/e428fa04a758cc87ea580c856a796e58e407504b Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r--src/nvim/charset.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 3b48392d49..24267ebd50 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1084,10 +1084,6 @@ void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *en
}
if (cursor != NULL) {
- if ((State & MODE_INSERT) == 0 && !on_NUL) {
- // cursor is after inserted text, unless on the NUL
- vcol += cts.cts_cur_text_width;
- }
if ((*ptr == TAB)
&& (State & MODE_NORMAL)
&& !wp->w_p_list
@@ -1096,6 +1092,10 @@ 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 ((State & MODE_INSERT) == 0 && !on_NUL) {
+ // cursor is after inserted text, unless on the NUL
+ vcol += cts.cts_cur_text_width;
+ }
// cursor at start
*cursor = vcol + head;
}