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>
This commit is contained in:
zeertzjq
2024-03-17 19:44:30 +01:00
committed by Christian Brabandt
parent f6272551bd
commit deb2204bff
4 changed files with 58 additions and 5 deletions

View File

@ -18,8 +18,7 @@
* displayed (excluding text written by external commands).
* ScreenAttrs[off] Contains the associated attributes.
* ScreenCols[off] Contains the virtual columns in the line. -1 means not
* available or before buffer text, MAXCOL means after the
* end of the line.
* available or before buffer text.
*
* LineOffset[row] Contains the offset into ScreenLines*[], ScreenAttrs[]
* and ScreenCols[] for each line.
@ -509,6 +508,8 @@ screen_line(
// Clear rest first, because it's left of the text.
if (clear_width > 0)
{
int clear_start = col;
while (col <= endcol && ScreenLines[off_to] == ' '
&& ScreenAttrs[off_to] == 0
&& (!enc_utf8 || ScreenLinesUC[off_to] == 0))
@ -519,6 +520,10 @@ screen_line(
if (col <= endcol)
screen_fill(row, row + 1, col + coloff,
endcol + coloff + 1, ' ', ' ', 0);
for (int i = endcol; i >= clear_start; i--)
ScreenCols[off_to + (i - col)] =
(flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol;
}
col = endcol + 1;
off_to = LineOffset[row] + col + coloff;