Mercurial > vim
comparison src/screen.c @ 34571:fdd232ab72ea v9.1.0184
patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Commit: https://github.com/vim/vim/commit/d0c1b7723f7e73763597af2f97a53d94ab7ed020
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Mar 16 15:03:33 2024 +0100
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Mar 2024 15:15:04 +0100 |
parents | 321281d8b353 |
children | 563b0a3bd697 |
comparison
equal
deleted
inserted
replaced
34570:68553f944407 | 34571:fdd232ab72ea |
---|---|
450 * "flags" can have bits: | 450 * "flags" can have bits: |
451 * SLF_POPUP popup window | 451 * SLF_POPUP popup window |
452 * SLF_RIGHTLEFT rightleft window: | 452 * SLF_RIGHTLEFT rightleft window: |
453 * When TRUE and "clear_width" > 0, clear columns 0 to "endcol" | 453 * When TRUE and "clear_width" > 0, clear columns 0 to "endcol" |
454 * When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width" | 454 * When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width" |
455 * SLF_INC_VCOL: | |
456 * When FALSE, use "last_vcol" for ScreenCols[] of the columns to clear. | |
457 * When TRUE, use an increasing sequence starting from "last_vcol + 1" for | |
458 * ScreenCols[] of the columns to clear. | |
455 */ | 459 */ |
456 void | 460 void |
457 screen_line( | 461 screen_line( |
458 win_T *wp, | 462 win_T *wp, |
459 int row, | 463 int row, |
460 int coloff, | 464 int coloff, |
461 int endcol, | 465 int endcol, |
462 int clear_width, | 466 int clear_width, |
467 colnr_T last_vcol, | |
463 int flags UNUSED) | 468 int flags UNUSED) |
464 { | 469 { |
465 unsigned off_from; | 470 unsigned off_from; |
466 unsigned off_to; | 471 unsigned off_to; |
467 unsigned max_off_from; | 472 unsigned max_off_from; |
773 // blank out the rest of the line | 778 // blank out the rest of the line |
774 while (col < clear_width && ScreenLines[off_to] == ' ' | 779 while (col < clear_width && ScreenLines[off_to] == ' ' |
775 && ScreenAttrs[off_to] == 0 | 780 && ScreenAttrs[off_to] == 0 |
776 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)) | 781 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)) |
777 { | 782 { |
778 ScreenCols[off_to] = MAXCOL; | 783 ScreenCols[off_to] = |
784 (flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol; | |
779 ++off_to; | 785 ++off_to; |
780 ++col; | 786 ++col; |
781 } | 787 } |
782 if (col < clear_width) | 788 if (col < clear_width) |
783 { | 789 { |
828 #endif | 834 #endif |
829 screen_fill(row, row + 1, col + coloff, clear_width + coloff, | 835 screen_fill(row, row + 1, col + coloff, clear_width + coloff, |
830 ' ', ' ', 0); | 836 ' ', ' ', 0); |
831 while (col < clear_width) | 837 while (col < clear_width) |
832 { | 838 { |
833 ScreenCols[off_to++] = MAXCOL; | 839 ScreenCols[off_to++] |
840 = (flags & SLF_INC_VCOL) ? ++last_vcol : last_vcol; | |
834 ++col; | 841 ++col; |
835 } | 842 } |
836 } | 843 } |
837 } | 844 } |
838 | 845 |