mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1371: ballooneval interferes with Insert completion (#22487)
Problem: Ballooneval interferes with Insert completion.
Solution: Ignore mouse-move events when completing. (closes vim/vim#12094,
closes vim/vim#12092)
440d4cb55b
This commit is contained in:
parent
fdb6b4d2e7
commit
361de6d54d
@ -2096,10 +2096,10 @@ bool ins_compl_prep(int c)
|
|||||||
edit_submode_extra = NULL;
|
edit_submode_extra = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore end of Select mode mapping and mouse scroll buttons.
|
// Ignore end of Select mode mapping and mouse scroll/movement.
|
||||||
if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP
|
if (c == K_SELECT || c == K_MOUSEDOWN || c == K_MOUSEUP
|
||||||
|| c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_EVENT
|
|| c == K_MOUSELEFT || c == K_MOUSERIGHT || c == K_MOUSEMOVE
|
||||||
|| c == K_COMMAND || c == K_LUA) {
|
|| c == K_EVENT || c == K_COMMAND || c == K_LUA) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3043,8 +3043,8 @@ static void get_next_spell_completion(linenr_T lnum)
|
|||||||
/// @param cur_match_pos current match position
|
/// @param cur_match_pos current match position
|
||||||
/// @param match_len
|
/// @param match_len
|
||||||
/// @param cont_s_ipos next ^X<> will set initial_pos
|
/// @param cont_s_ipos next ^X<> will set initial_pos
|
||||||
static char *ins_comp_get_next_word_or_line(buf_T *ins_buf, pos_T *cur_match_pos, int *match_len,
|
static char *ins_compl_get_next_word_or_line(buf_T *ins_buf, pos_T *cur_match_pos, int *match_len,
|
||||||
bool *cont_s_ipos)
|
bool *cont_s_ipos)
|
||||||
{
|
{
|
||||||
*match_len = 0;
|
*match_len = 0;
|
||||||
char *ptr = ml_get_buf(ins_buf, cur_match_pos->lnum, false) + cur_match_pos->col;
|
char *ptr = ml_get_buf(ins_buf, cur_match_pos->lnum, false) + cur_match_pos->col;
|
||||||
@ -3206,8 +3206,8 @@ static int get_next_default_completion(ins_compl_next_state_T *st, pos_T *start_
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int len;
|
int len;
|
||||||
char *ptr = ins_comp_get_next_word_or_line(st->ins_buf, st->cur_match_pos,
|
char *ptr = ins_compl_get_next_word_or_line(st->ins_buf, st->cur_match_pos,
|
||||||
&len, &cont_s_ipos);
|
&len, &cont_s_ipos);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -375,6 +375,54 @@ func Test_completefunc_info()
|
|||||||
set completefunc&
|
set completefunc&
|
||||||
endfunc
|
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
|
" Check that when using feedkeys() typeahead does not interrupt searching for
|
||||||
" completions.
|
" completions.
|
||||||
func Test_compl_feedkeys()
|
func Test_compl_feedkeys()
|
||||||
|
Loading…
Reference in New Issue
Block a user