diff src/testing.c @ 28885:947b7d061b07 v8.2.4965

patch 8.2.4965: GUI: testing mouse move event depends on screen cell size Commit: https://github.com/vim/vim/commit/7add8d373185a6b20aeeb8c30adb9acc68de66ec Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 16 15:27:46 2022 +0100 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size Problem: GUI: testing mouse move event depends on screen cell size. Solution: Multiply the row and column with the screen cell size.
author Bram Moolenaar <Bram@vim.org>
date Mon, 16 May 2022 16:30:03 +0200
parents 26a2836923d6
children 0e0e298e05c1
line wrap: on
line diff
--- a/src/testing.c
+++ b/src/testing.c
@@ -1386,7 +1386,15 @@ test_gui_mouse_event(dict_T *args)
     col = (int)dict_get_number(args, (char_u *)"col");
 
     if (move)
+    {
+	if (dict_get_bool(args, (char_u *)"cell", FALSE))
+	{
+	    // click in the middle of the character cell
+	    row = row * gui.char_height + gui.char_height / 2;
+	    col = col * gui.char_width + gui.char_width / 2;
+	}
 	gui_mouse_moved(col, row);
+    }
     else
     {
 	button = (int)dict_get_number(args, (char_u *)"button");