Mercurial > vim
comparison src/testdir/test_visual.vim @ 33982:63341afcd329 v9.0.2177
patch 9.0.2177: Wrong cursor position when dragging out of window
Commit: https://github.com/vim/vim/commit/ec14924368e23f2430815c009bd554f88de9c57f
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Dec 19 20:28:31 2023 +0100
patch 9.0.2177: Wrong cursor position when dragging out of window
Problem: Wrong cursor position when dragging out of window.
Solution: Don't use ScreenCols[] when mouse is not in current window.
closes: #13717
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Dec 2023 20:30:09 +0100 |
parents | 4c975fa0a442 |
children | 8b5471360746 |
comparison
equal
deleted
inserted
replaced
33981:00a926acf8d7 | 33982:63341afcd329 |
---|---|
1583 " visual gr_cmd | 1583 " visual gr_cmd |
1584 call setline(1, [' ']) | 1584 call setline(1, [' ']) |
1585 call feedkeys("\<c-v>$gr\<c-c>", 'tx') | 1585 call feedkeys("\<c-v>$gr\<c-c>", 'tx') |
1586 call assert_equal([''], getline(1, 1)) | 1586 call assert_equal([''], getline(1, 1)) |
1587 bw! | 1587 bw! |
1588 endfu | 1588 endfunc |
1589 | |
1590 func Test_visual_drag_out_of_window() | |
1591 rightbelow vnew | |
1592 call setline(1, '123456789') | |
1593 set mouse=a | |
1594 func ClickExpr(off) | |
1595 call test_setmouse(1, getwininfo(win_getid())[0].wincol + a:off) | |
1596 return "\<LeftMouse>" | |
1597 endfunc | |
1598 func DragExpr(off) | |
1599 call test_setmouse(1, getwininfo(win_getid())[0].wincol + a:off) | |
1600 return "\<LeftDrag>" | |
1601 endfunc | |
1602 | |
1603 nnoremap <expr> <F2> ClickExpr(5) | |
1604 nnoremap <expr> <F3> DragExpr(-1) | |
1605 redraw | |
1606 call feedkeys("\<F2>\<F3>\<LeftRelease>", 'tx') | |
1607 call assert_equal([1, 6], [col('.'), col('v')]) | |
1608 call feedkeys("\<Esc>", 'tx') | |
1609 | |
1610 nnoremap <expr> <F2> ClickExpr(6) | |
1611 nnoremap <expr> <F3> DragExpr(-2) | |
1612 redraw | |
1613 call feedkeys("\<F2>\<F3>\<LeftRelease>", 'tx') | |
1614 call assert_equal([1, 7], [col('.'), col('v')]) | |
1615 call feedkeys("\<Esc>", 'tx') | |
1616 | |
1617 nunmap <F2> | |
1618 nunmap <F3> | |
1619 delfunc ClickExpr | |
1620 delfunc DragExpr | |
1621 set mouse& | |
1622 bwipe! | |
1623 endfunc | |
1589 | 1624 |
1590 " vim: shiftwidth=2 sts=2 expandtab | 1625 " vim: shiftwidth=2 sts=2 expandtab |