1
0
forked from aniani/vim

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>
This commit is contained in:
zeertzjq
2023-10-14 11:32:28 +02:00
committed by Christian Brabandt
parent cd6ee69358
commit b583eda703
6 changed files with 62 additions and 7 deletions

View File

@@ -10376,6 +10376,8 @@ virtcol2col({winid}, {lnum}, {col}) *virtcol2col()*
character in window {winid} at buffer line {lnum} and virtual
column {col}.
If buffer line {lnum} is an empty line, 0 is returned.
If {col} is greater than the last virtual column in line
{lnum}, then the byte index of the character at the last
virtual column is returned.