To: vim_dev@googlegroups.com Subject: Patch 9.0.1371 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1371 Problem: Ballooneval interferes with Insert completion. Solution: Ignore mouse-move events when completing. (closes #12094, closes #12092) Files: src/insexpand.c, src/testdir/test_ins_complete.vim *** ../vim-9.0.1370/src/insexpand.c 2023-02-21 14:27:34.516360384 +0000 --- src/insexpand.c 2023-03-02 17:46:40.924399585 +0000 *************** *** 2333,2341 **** if (c != Ctrl_R && vim_is_ctrl_x_key(c)) edit_submode_extra = NULL; ! // Ignore end of Select mode mapping and mouse scroll buttons. if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP ! || c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_COMMAND || c == K_SCRIPT_COMMAND) return retval; --- 2333,2341 ---- if (c != Ctrl_R && vim_is_ctrl_x_key(c)) edit_submode_extra = NULL; ! // Ignore end of Select mode mapping and mouse scroll/movement. if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP ! || c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_MOUSEMOVE || c == K_COMMAND || c == K_SCRIPT_COMMAND) return retval; *************** *** 3491,3497 **** * "cur_match_pos" for completion. The length of the match is set in "len". */ static char_u * ! ins_comp_get_next_word_or_line( buf_T *ins_buf, // buffer being scanned pos_T *cur_match_pos, // current match position int *match_len, --- 3491,3497 ---- * "cur_match_pos" for completion. The length of the match is set in "len". */ static char_u * ! ins_compl_get_next_word_or_line( buf_T *ins_buf, // buffer being scanned pos_T *cur_match_pos, // current match position int *match_len, *************** *** 3675,3682 **** && start_pos->col == st->cur_match_pos->col) continue; ! ptr = ins_comp_get_next_word_or_line(st->ins_buf, st->cur_match_pos, ! &len, &cont_s_ipos); if (ptr == NULL) continue; --- 3675,3682 ---- && start_pos->col == st->cur_match_pos->col) continue; ! ptr = ins_compl_get_next_word_or_line(st->ins_buf, st->cur_match_pos, ! &len, &cont_s_ipos); if (ptr == NULL) continue; *** ../vim-9.0.1370/src/testdir/test_ins_complete.vim 2023-01-28 19:18:56.729720605 +0000 --- src/testdir/test_ins_complete.vim 2023-03-02 17:46:40.924399585 +0000 *************** *** 412,417 **** --- 412,465 ---- set completefunc& endfunc + " Test that mouse scrolling/movement should not interrupt completion. + func Test_mouse_scroll_move_during_completion() + new + com! -buffer TestCommand1 echo 'TestCommand1' + com! -buffer TestCommand2 echo 'TestCommand2' + call setline(1, ['', '', '', '', '']) + call cursor(5, 1) + + " Without completion menu scrolling can move text. + set completeopt-=menu wrap + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_notequal(1, winsaveview().topline) + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(1, winsaveview().topline) + set nowrap + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_notequal(0, winsaveview().leftcol) + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(0, winsaveview().leftcol) + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + + " With completion menu scrolling cannot move text. + set completeopt+=menu wrap + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(1, winsaveview().topline) + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(1, winsaveview().topline) + set nowrap + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(0, winsaveview().leftcol) + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(0, winsaveview().leftcol) + call feedkeys("ccT\\\\", 'tx') + call assert_equal('TestCommand2', getline('.')) + + bwipe! + set completeopt& wrap& + endfunc + " Check that when using feedkeys() typeahead does not interrupt searching for " completions. func Test_compl_feedkeys() *** ../vim-9.0.1370/src/version.c 2023-03-02 17:38:30.019743929 +0000 --- src/version.c 2023-03-02 17:48:28.564528075 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1371, /**/ -- hundred-and-one symptoms of being an internet addict: 211. Your husband leaves you...taking the computer with him and you call him crying, and beg him to bring the computer back. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///