summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_normal.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-20 20:08:40 +0200
committerChristian Brabandt <cb@256bit.org>2023-09-20 20:08:40 +0200
commit03cd697d635f1b0e7ffe21cf8244a8fb755f2ddb (patch)
treed856a22b0fc6373c66b20b182705ac14cc767c49 /src/testdir/test_normal.vim
parent5790a54166793554d16f6a85d8824632860b8b37 (diff)
patch 9.0.1919: Wrong curswant when clicking on empty line or with vsplitsv9.0.1919
Problem: Wrong curswant when clicking on empty line or with vsplits. Solution: Don't check for ScreenCols[] before the start of the window and handle empty line properly. closes: #13132 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/testdir/test_normal.vim')
-rw-r--r--src/testdir/test_normal.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 9111eb84a1..c7d37f066f 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -4104,6 +4104,39 @@ func Test_normal_click_on_double_width_char()
let &mouse = save_mouse
endfunc
+func Test_normal_click_on_empty_line()
+ let save_mouse = &mouse
+ set mouse=a
+ botright new
+ call setline(1, ['', '', ''])
+ let row = win_screenpos(0)[0] + 2
+ 20vsplit
+ redraw
+
+ call test_setmouse(row, 1)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 3, 1, 0, 1], getcurpos())
+ call test_setmouse(row, 2)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 3, 1, 0, 2], getcurpos())
+ call test_setmouse(row, 10)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 3, 1, 0, 10], getcurpos())
+
+ call test_setmouse(row, 21 + 1)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 3, 1, 0, 1], getcurpos())
+ call test_setmouse(row, 21 + 2)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 3, 1, 0, 2], getcurpos())
+ call test_setmouse(row, 21 + 10)
+ call feedkeys("\<LeftMouse>", 'xt')
+ call assert_equal([0, 3, 1, 0, 10], getcurpos())
+
+ bwipe!
+ let &mouse = save_mouse
+endfunc
+
func Test_normal33_g_cmd_nonblank()
" Test that g<End> goes to the last non-blank char and g$ to the last
" visible column