Mercurial > vim
comparison src/testdir/test_functions.vim @ 33549:bfe07ef45143 v9.0.2022
patch 9.0.2022: getmousepos() returns wrong index for TAB char
Commit: https://github.com/vim/vim/commit/b583eda7031b1f6a3469a2537d0c10ca5fa5568e
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Oct 14 11:32:28 2023 +0200
patch 9.0.2022: getmousepos() returns wrong index for TAB char
Problem: When clicking in the middle of a TAB, getmousepos() returns
the column of the next char instead of the TAB.
Solution: Break out of the loop when the vcol to find is inside current
char. Fix invalid memory access when calling virtcol2col() on
an empty line.
closes: #13321
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 14 Oct 2023 11:45:04 +0200 |
parents | b21a1fc34254 |
children | 8fc442c731ca |
comparison
equal
deleted
inserted
replaced
33548:c8e41b6fe002 | 33549:bfe07ef45143 |
---|---|
3364 \ winrow: 1, | 3364 \ winrow: 1, |
3365 \ wincol: 1, | 3365 \ wincol: 1, |
3366 \ line: 1, | 3366 \ line: 1, |
3367 \ column: 1, | 3367 \ column: 1, |
3368 \ }, getmousepos()) | 3368 \ }, getmousepos()) |
3369 call test_setmouse(1, 2) | |
3370 call assert_equal(#{ | |
3371 \ screenrow: 1, | |
3372 \ screencol: 2, | |
3373 \ winid: win_getid(), | |
3374 \ winrow: 1, | |
3375 \ wincol: 2, | |
3376 \ line: 1, | |
3377 \ column: 1, | |
3378 \ }, getmousepos()) | |
3379 call test_setmouse(1, 8) | |
3380 call assert_equal(#{ | |
3381 \ screenrow: 1, | |
3382 \ screencol: 8, | |
3383 \ winid: win_getid(), | |
3384 \ winrow: 1, | |
3385 \ wincol: 8, | |
3386 \ line: 1, | |
3387 \ column: 1, | |
3388 \ }, getmousepos()) | |
3389 call test_setmouse(1, 9) | |
3390 call assert_equal(#{ | |
3391 \ screenrow: 1, | |
3392 \ screencol: 9, | |
3393 \ winid: win_getid(), | |
3394 \ winrow: 1, | |
3395 \ wincol: 9, | |
3396 \ line: 1, | |
3397 \ column: 2, | |
3398 \ }, getmousepos()) | |
3399 call test_setmouse(1, 12) | |
3400 call assert_equal(#{ | |
3401 \ screenrow: 1, | |
3402 \ screencol: 12, | |
3403 \ winid: win_getid(), | |
3404 \ winrow: 1, | |
3405 \ wincol: 12, | |
3406 \ line: 1, | |
3407 \ column: 2, | |
3408 \ }, getmousepos()) | |
3369 call test_setmouse(1, 25) | 3409 call test_setmouse(1, 25) |
3370 call assert_equal(#{ | 3410 call assert_equal(#{ |
3371 \ screenrow: 1, | 3411 \ screenrow: 1, |
3372 \ screencol: 25, | 3412 \ screencol: 25, |
3373 \ winid: win_getid(), | 3413 \ winid: win_getid(), |