forked from aniani/vim
patch 8.2.4692: no test for what 8.2.4691 fixes
Problem: No test for what 8.2.4691 fixes. Solution: Add a test. Use a more generic sotlution. (closes #10090)
This commit is contained in:
@@ -1566,4 +1566,37 @@ func Test_plug_remap()
|
||||
%bw!
|
||||
endfunc
|
||||
|
||||
" Test for mapping <LeftDrag> in Insert mode
|
||||
func Test_mouse_drag_insert_map()
|
||||
set mouse=a
|
||||
func ClickExpr()
|
||||
call test_setmouse(1, 1)
|
||||
return "\<LeftMouse>"
|
||||
endfunc
|
||||
func DragExpr()
|
||||
call test_setmouse(1, 2)
|
||||
return "\<LeftDrag>"
|
||||
endfunc
|
||||
inoremap <expr> <F2> ClickExpr()
|
||||
imap <expr> <F3> DragExpr()
|
||||
|
||||
inoremap <LeftDrag> <LeftDrag><Cmd>let g:dragged = 1<CR>
|
||||
exe "normal i\<F2>\<F3>"
|
||||
call assert_equal(1, g:dragged)
|
||||
call assert_equal('v', mode())
|
||||
exe "normal! \<C-\>\<C-N>"
|
||||
unlet g:dragged
|
||||
|
||||
inoremap <LeftDrag> <LeftDrag><C-\><C-N>
|
||||
exe "normal i\<F2>\<F3>"
|
||||
call assert_equal('n', mode())
|
||||
|
||||
iunmap <LeftDrag>
|
||||
iunmap <F2>
|
||||
iunmap <F3>
|
||||
delfunc ClickExpr
|
||||
delfunc DragExpr
|
||||
set mouse&
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Reference in New Issue
Block a user