comparison src/testdir/test_conceal.vim @ 34576:563b0a3bd697 v9.1.0186

patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal Commit: https://github.com/vim/vim/commit/deb2204bffa075ed5485415fc2dbd20e75d87ea4 Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Mar 17 19:44:30 2024 +0100 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal Problem: Wrong cursor position when clicking after end of line with 'rightleft', 'virtualedit' and conceal. Solution: Set values in ScreenCols[] also with SLF_RIGHTLEFT. Also fix off-by-one cursor position with 'colorcolumn' (zeertzjq). closes: #14218 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Mar 2024 20:00:02 +0100
parents fdd232ab72ea
children 6b249d4970ad
comparison
equal deleted inserted replaced
34575:632aa96ea9c9 34576:563b0a3bd697
462 call feedkeys("\<LeftMouse>", "tx") 462 call feedkeys("\<LeftMouse>", "tx")
463 call assert_equal([0, 1, 24, 11, 35], getcurpos()) 463 call assert_equal([0, 1, 24, 11, 35], getcurpos())
464 call test_setmouse(1, 32) 464 call test_setmouse(1, 32)
465 call feedkeys("\<LeftMouse>", "tx") 465 call feedkeys("\<LeftMouse>", "tx")
466 call assert_equal([0, 1, 24, 12, 36], getcurpos()) 466 call assert_equal([0, 1, 24, 12, 36], getcurpos())
467 " Behavior should also be the same with 'colorcolumn'.
468 setlocal colorcolumn=30
469 redraw
470 call test_setmouse(1, 31)
471 call feedkeys("\<LeftMouse>", "tx")
472 call assert_equal([0, 1, 24, 11, 35], getcurpos())
473 call test_setmouse(1, 32)
474 call feedkeys("\<LeftMouse>", "tx")
475 call assert_equal([0, 1, 24, 12, 36], getcurpos())
476 setlocal colorcolumn&
477
478 if has('rightleft')
479 setlocal rightleft
480 call assert_equal([
481 \ ' ereh kcilc laecnoc',
482 \ ], ScreenLines(1, 40))
483 " Click on the space between "this" and "click" puts cursor there.
484 call test_setmouse(1, 41 - 9)
485 call feedkeys("\<LeftMouse>", "tx")
486 call assert_equal([0, 1, 13, 0, 13], getcurpos())
487 " Click on 'h' of "here" puts cursor there.
488 call test_setmouse(1, 41 - 16)
489 call feedkeys("\<LeftMouse>", "tx")
490 call assert_equal([0, 1, 20, 0, 20], getcurpos())
491 " Click on 'e' of "here" puts cursor there.
492 call test_setmouse(1, 41 - 19)
493 call feedkeys("\<LeftMouse>", "tx")
494 call assert_equal([0, 1, 23, 0, 23], getcurpos())
495 " Click after end of line puts cursor there with 'virtualedit'.
496 call test_setmouse(1, 41 - 20)
497 call feedkeys("\<LeftMouse>", "tx")
498 call assert_equal([0, 1, 24, 0, 24], getcurpos())
499 call test_setmouse(1, 41 - 21)
500 call feedkeys("\<LeftMouse>", "tx")
501 call assert_equal([0, 1, 24, 1, 25], getcurpos())
502 call test_setmouse(1, 41 - 22)
503 call feedkeys("\<LeftMouse>", "tx")
504 call assert_equal([0, 1, 24, 2, 26], getcurpos())
505 call test_setmouse(1, 41 - 31)
506 call feedkeys("\<LeftMouse>", "tx")
507 call assert_equal([0, 1, 24, 11, 35], getcurpos())
508 call test_setmouse(1, 41 - 32)
509 call feedkeys("\<LeftMouse>", "tx")
510 call assert_equal([0, 1, 24, 12, 36], getcurpos())
511 setlocal rightleft&
512 endif
513
467 set virtualedit& 514 set virtualedit&
468 515
469 " Test with a wrapped line. 516 " Test with a wrapped line.
470 call setline(1, ['conceal this click here']->repeat(3)->join()) 517 call setline(1, ['conceal this click here']->repeat(3)->join())
471 call assert_equal([ 518 call assert_equal([