diff src/testdir/test_functions.vim @ 28061:050d49de7a66 v8.2.4555

patch 8.2.4555: getmousepos() returns the wrong column Commit: https://github.com/vim/vim/commit/986b0fd0c550d9834a3cc45dd87555c13152c391 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 13 12:06:07 2022 +0000 patch 8.2.4555: getmousepos() returns the wrong column Problem: getmousepos() returns the wrong column. (Ernie Rael) Solution: Limit to the text size, not the number of bytes.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Mar 2022 13:15:04 +0100
parents 9b01fea87065
children 236b80af9833
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2750,6 +2750,32 @@ func Test_getcurpos_setpos()
   call assert_equal([0, 0, 0, 0, 0], getcurpos(1999))
 endfunc
 
+func Test_getmousepos()
+  enew!
+  call setline(1, "\t\t\t1234")
+  call test_setmouse(1, 25)
+  call assert_equal(#{
+        \ screenrow: 1,
+        \ screencol: 25,
+        \ winid: win_getid(),
+        \ winrow: 1,
+        \ wincol: 25,
+        \ line: 1,
+        \ column: 25,
+        \ }, getmousepos())
+  call test_setmouse(1, 50)
+  call assert_equal(#{
+        \ screenrow: 1,
+        \ screencol: 50,
+        \ winid: win_getid(),
+        \ winrow: 1,
+        \ wincol: 50,
+        \ line: 1,
+        \ column: 29,
+        \ }, getmousepos())
+  bwipe!
+endfunc
+
 " Test for glob()
 func Test_glob()
   call assert_equal('', glob(test_null_string()))