diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-03-02 17:51:32 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-03-02 17:51:32 +0000 |
commit | 440d4cb55b84fd4b188630abc4a1312598649af0 (patch) | |
tree | 19a7efd9ba5bb5da6ddf2097a757bab8500852f8 /src/testdir/test_ins_complete.vim | |
parent | c3f971f28989fde7d94b45957496fecd6e6f2177 (diff) |
patch 9.0.1371: ballooneval interferes with Insert completionv9.0.1371
Problem: Ballooneval interferes with Insert completion.
Solution: Ignore mouse-move events when completing. (closes #12094,
closes #12092)
Diffstat (limited to 'src/testdir/test_ins_complete.vim')
-rw-r--r-- | src/testdir/test_ins_complete.vim | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index fc7e8cb0ed..20dd55676a 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -412,6 +412,54 @@ func Test_completefunc_info() 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\<C-X>\<C-V>\<ScrollWheelDown>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_notequal(1, winsaveview().topline) + call feedkeys("ccT\<C-X>\<C-V>\<ScrollWheelUp>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(1, winsaveview().topline) + set nowrap + call feedkeys("ccT\<C-X>\<C-V>\<ScrollWheelRight>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_notequal(0, winsaveview().leftcol) + call feedkeys("ccT\<C-X>\<C-V>\<ScrollWheelLeft>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(0, winsaveview().leftcol) + call feedkeys("ccT\<C-X>\<C-V>\<MouseMove>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + + " With completion menu scrolling cannot move text. + set completeopt+=menu wrap + call feedkeys("ccT\<C-X>\<C-V>\<ScrollWheelDown>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(1, winsaveview().topline) + call feedkeys("ccT\<C-X>\<C-V>\<ScrollWheelUp>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(1, winsaveview().topline) + set nowrap + call feedkeys("ccT\<C-X>\<C-V>\<ScrollWheelRight>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(0, winsaveview().leftcol) + call feedkeys("ccT\<C-X>\<C-V>\<ScrollWheelLeft>\<C-V>", 'tx') + call assert_equal('TestCommand2', getline('.')) + call assert_equal(0, winsaveview().leftcol) + call feedkeys("ccT\<C-X>\<C-V>\<MouseMove>\<C-V>", '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() |