To: vim_dev@googlegroups.com Subject: Patch 8.1.1262 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1262 Problem: Cannot simulate a mouse click in a test. Solution: Add test_setmouse(). Files: src/evalfunc.c, runtime/doc/eval.txt, runtime/doc/usr_41.txt *** ../vim-8.1.1261/src/evalfunc.c 2019-05-02 23:00:19.223658473 +0200 --- src/evalfunc.c 2019-05-04 15:35:49.037326346 +0200 *************** *** 456,461 **** --- 456,462 ---- #ifdef FEAT_GUI static void f_test_scrollbar(typval_T *argvars, typval_T *rettv); #endif + static void f_test_setmouse(typval_T *argvars, typval_T *rettv); static void f_test_settime(typval_T *argvars, typval_T *rettv); #ifdef FEAT_FLOAT static void f_tan(typval_T *argvars, typval_T *rettv); *************** *** 993,998 **** --- 994,1000 ---- #ifdef FEAT_GUI {"test_scrollbar", 3, 3, f_test_scrollbar}, #endif + {"test_setmouse", 2, 2, f_test_setmouse}, {"test_settime", 1, 1, f_test_settime}, #ifdef FEAT_TIMERS {"timer_info", 0, 1, f_timer_info}, *************** *** 14494,14499 **** --- 14496,14508 ---- #endif static void + f_test_setmouse(typval_T *argvars, typval_T *rettv UNUSED) + { + mouse_row = (time_t)tv_get_number(&argvars[0]) - 1; + mouse_col = (time_t)tv_get_number(&argvars[1]) - 1; + } + + static void f_test_settime(typval_T *argvars, typval_T *rettv UNUSED) { time_for_testing = (time_t)tv_get_number(&argvars[0]); *** ../vim-8.1.1261/runtime/doc/eval.txt 2019-05-02 23:00:19.227658452 +0200 --- runtime/doc/eval.txt 2019-05-04 15:22:45.893532231 +0200 *************** *** 2681,2686 **** --- 2700,2706 ---- test_refcount({expr}) Number get the reference count of {expr} test_scrollbar({which}, {value}, {dragging}) none scroll in the GUI for testing + test_setmouse({row}, {col}) none set the mouse position for testing test_settime({expr}) none set current time for testing timer_info([{id}]) List information about timers timer_pause({id}, {pause}) none pause or unpause a timer *************** *** 9780,9785 **** --- 9842,9854 ---- Only works when the {which} scrollbar actually exists, obviously only when using the GUI. + test_setmouse({row}, {col}) *test_setmouse()* + Set the mouse position to be used for the next mouse action. + {row} and {col} are one based. + For example: > + call test_setmouse(4, 20) + call feedkeys("\", "xt") + test_settime({expr}) *test_settime()* Set the time Vim uses internally. Currently only used for timestamps in the history, as they are used in viminfo, and *** ../vim-8.1.1261/runtime/doc/usr_41.txt 2019-04-27 20:36:52.530303581 +0200 --- runtime/doc/usr_41.txt 2019-05-04 15:23:11.301395183 +0200 *************** *** 946,951 **** --- 955,964 ---- test_null_partial() return a null Partial function test_null_string() return a null String test_settime() set the time Vim uses internally + test_setmouse() set the mouse position + test_feedinput() add key sequence to input buffer + test_option_not_set() reset flag indicating option was set + test_scrollbar() simulate scrollbar movement in the GUI Inter-process communication: *channel-functions* ch_canread() check if there is something to read *** ../vim-8.1.1261/src/version.c 2019-05-04 15:05:24.931269287 +0200 --- src/version.c 2019-05-04 15:25:24.732676392 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1262, /**/ -- I wonder, do vegetarians eat fruit bats? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///