patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap

Problem:  Cursor position wrong when clicking with conceal and wrap.
Solution: Use the virtual column of the last char for ScreenCols[] in
          boguscols.  Remove use of MAXCOL in ScreenCols[].  Rename
          third argument of wlv_screen_line() to "clear_end" as that's
          clearer what it does (zeertzjq).

related: 14192
closes: #14200

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-03-16 15:03:33 +01:00
committed by Christian Brabandt
parent 9e7f1fc2f1
commit d0c1b7723f
9 changed files with 147 additions and 112 deletions

View File

@ -452,6 +452,10 @@ skip_for_popup(int row, int col)
* SLF_RIGHTLEFT rightleft window:
* When TRUE and "clear_width" > 0, clear columns 0 to "endcol"
* When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
* SLF_INC_VCOL:
* When FALSE, use "last_vcol" for ScreenCols[] of the columns to clear.
* When TRUE, use an increasing sequence starting from "last_vcol + 1" for
* ScreenCols[] of the columns to clear.
*/
void
screen_line(
@ -460,6 +464,7 @@ screen_line(
int coloff,
int endcol,
int clear_width,
colnr_T last_vcol,
int flags UNUSED)
{
unsigned off_from;
@ -775,7 +780,8 @@ screen_line(
&& ScreenAttrs[off_to] == 0
&& (!enc_utf8 || ScreenLinesUC[off_to] == 0))
{
ScreenCols[off_to] = MAXCOL;
ScreenCols[off_to] =
(flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol;
++off_to;
++col;
}
@ -830,7 +836,8 @@ screen_line(
' ', ' ', 0);
while (col < clear_width)
{
ScreenCols[off_to++] = MAXCOL;
ScreenCols[off_to++]
= (flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol;
++col;
}
}