Mercurial > vim
diff src/testdir/test_mapping.vim @ 28333:04310f81143d v8.2.4692
patch 8.2.4692: no test for what 8.2.4691 fixes
Commit: https://github.com/vim/vim/commit/0f68e6c07aaf62c034a242f183b93c1bb44e7f93
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Apr 5 13:17:01 2022 +0100
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 https://github.com/vim/vim/issues/10090)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 05 Apr 2022 14:30:03 +0200 |
parents | 5147f3d3ed30 |
children | a1de4ee8c40d |
line wrap: on
line diff
--- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -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