vim-patch:9.0.1705: cursor position wrong when clicking on an unprintable char

Problem:  cursor position wrong when clicking on an unprintable char
Solution: Don't update prev_ptr when wlv.n_extra is not zero.

closes: vim/vim#12664

b25dbb3f9b

Tests only. Code superseded by patch 9.0.1725.
This commit is contained in:
zeertzjq 2023-08-18 14:59:25 +08:00
parent 5ff725fa94
commit b0dda500e9

View File

@ -4049,4 +4049,47 @@ func Test_normal_r_ctrl_v_cmd()
bw!
endfunc
" Test clicking on a TAB or an unprintable character in Normal mode
func Test_normal_click_on_ctrl_char()
let save_mouse = &mouse
set mouse=a
new
call setline(1, "a\<Tab>b\<C-K>c")
redraw
call Ntest_setmouse(1, 1)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 1, 0, 1], getcurpos())
call Ntest_setmouse(1, 2)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 2, 0, 8], getcurpos())
call Ntest_setmouse(1, 3)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 2, 0, 8], getcurpos())
call Ntest_setmouse(1, 7)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 2, 0, 8], getcurpos())
call Ntest_setmouse(1, 8)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 2, 0, 8], getcurpos())
call Ntest_setmouse(1, 9)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 3, 0, 9], getcurpos())
call Ntest_setmouse(1, 10)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 4, 0, 10], getcurpos())
call Ntest_setmouse(1, 11)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 4, 0, 10], getcurpos())
call Ntest_setmouse(1, 12)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 5, 0, 12], getcurpos())
call Ntest_setmouse(1, 13)
call feedkeys("\<LeftMouse>", 'xt')
call assert_equal([0, 1, 5, 0, v:maxcol], getcurpos())
bwipe!
let &mouse = save_mouse
endfunc
" vim: shiftwidth=2 sts=2 expandtab