summaryrefslogtreecommitdiff
path: root/src/testing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing.c')
-rw-r--r--src/testing.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/testing.c b/src/testing.c
index 48ba14d2c..c05348753 100644
--- a/src/testing.c
+++ b/src/testing.c
@@ -1368,22 +1368,35 @@ test_gui_mouse_event(dict_T *args)
int col;
int repeated_click;
int_u mods;
+ int move;
- if (dict_find(args, (char_u *)"button", -1) == NULL
- || dict_find(args, (char_u *)"row", -1) == NULL
- || dict_find(args, (char_u *)"col", -1) == NULL
+ if (dict_find(args, (char_u *)"row", -1) == NULL
+ || dict_find(args, (char_u *)"col", -1) == NULL)
+ return FALSE;
+
+ // Note: "move" is optional, requires fewer arguments
+ move = (int)dict_get_bool(args, (char_u *)"move", FALSE);
+
+ if (!move && (dict_find(args, (char_u *)"button", -1) == NULL
|| dict_find(args, (char_u *)"multiclick", -1) == NULL
- || dict_find(args, (char_u *)"modifiers", -1) == NULL)
+ || dict_find(args, (char_u *)"modifiers", -1) == NULL))
return FALSE;
- button = (int)dict_get_number(args, (char_u *)"button");
row = (int)dict_get_number(args, (char_u *)"row");
col = (int)dict_get_number(args, (char_u *)"col");
- repeated_click = (int)dict_get_number(args, (char_u *)"multiclick");
- mods = (int)dict_get_number(args, (char_u *)"modifiers");
- gui_send_mouse_event(button, TEXT_X(col - 1), TEXT_Y(row - 1),
+ if (move)
+ gui_mouse_moved(col, row);
+ else
+ {
+ button = (int)dict_get_number(args, (char_u *)"button");
+ repeated_click = (int)dict_get_number(args, (char_u *)"multiclick");
+ mods = (int)dict_get_number(args, (char_u *)"modifiers");
+
+ gui_send_mouse_event(button, TEXT_X(col - 1), TEXT_Y(row - 1),
repeated_click, mods);
+ }
+
return TRUE;
}