changeset 34441:84a5cafeb34c v9.1.0140

patch 9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown Commit: https://github.com/vim/vim/commit/da0c9137d1ec96f4d79b818502d2f921a21f710e Author: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Date: Tue Feb 27 20:25:10 2024 +0100 patch 9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown Problem: The cursor screen row was incorrectly being calculated when the cursor follows a 1 character text_align 'below' virtual text line, resulting in the cursor being shown on the wrong line. This was caused by a cell size of 2 instead of 1 being used for the EOL character, which propagated to the calculation of space for putting the 'below' virtual text on its own line. (rickhowe) Solution: Fix the size used for the EOL character in calculating the cursor's screen position (Dylan Thacker-Smith) fixes: #11959 related: #12028 closes: #14096 Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 27 Feb 2024 20:30:03 +0100
parents 85d7e01f64b7
children b082ec3e4be8
files src/charset.c src/testdir/dumps/Test_prop_above_below_empty_1.dump src/testdir/dumps/Test_prop_above_below_empty_2.dump src/testdir/dumps/Test_prop_above_below_empty_3.dump src/testdir/dumps/Test_prop_above_below_empty_4.dump src/testdir/dumps/Test_prop_above_below_empty_5.dump src/testdir/test_textprop.vim src/version.c
diffstat 8 files changed, 61 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/src/charset.c
+++ b/src/charset.c
@@ -1160,8 +1160,12 @@ win_lbr_chartabsize(
      * First get the normal size, without 'linebreak' or text properties
      */
     size = win_chartabsize(wp, s, vcol);
-    if (*s == NUL && !has_lcs_eol)
-	size = 0;  // NUL is not displayed
+    if (*s == NUL)
+    {
+	// 1 cell for EOL list char (if present), as opposed to the two cell ^@
+	// for a NUL character in the text.
+	size = has_lcs_eol ? 1 : 0;
+    }
 # ifdef FEAT_LINEBREAK
     int is_doublewidth = has_mbyte && size == 2 && MB_BYTE2LEN(*s) > 1;
 # endif
--- a/src/testdir/dumps/Test_prop_above_below_empty_1.dump
+++ b/src/testdir/dumps/Test_prop_above_below_empty_1.dump
@@ -1,16 +1,16 @@
-| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|1| |1+0#0000000&@7| @47
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|2| | +0#0000000&@55
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|3| |3+0#0000000&@8| @46
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|4| | +0#0000000&@55
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|5| >5+0#0000000&@10| @44
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
 @42|5|,|1|-|5|7| @7|A|l@1| 
--- a/src/testdir/dumps/Test_prop_above_below_empty_2.dump
+++ b/src/testdir/dumps/Test_prop_above_below_empty_2.dump
@@ -1,16 +1,16 @@
-| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|1| |1+0#0000000&@7|$+0#4040ff13&| +0#0000000&@46
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|2| |$+0#4040ff13&| +0#0000000&@54
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|3| |3+0#0000000&@8|$+0#4040ff13&| +0#0000000&@45
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|4| |$+0#4040ff13&| +0#0000000&@54
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|5| >5+0#0000000&@10|$+0#4040ff13&| +0#0000000&@43
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
 |:|s|e|t| |l|i|s|t| @32|5|,|1|-|5|7| @7|A|l@1| 
--- a/src/testdir/dumps/Test_prop_above_below_empty_3.dump
+++ b/src/testdir/dumps/Test_prop_above_below_empty_3.dump
@@ -1,16 +1,16 @@
-| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|1| |1+0#0000000&@7| | +0&#ffd7d7255| +0&#ffffff0@45
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|2| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|3| |3+0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|4| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|5| >5+0#0000000&@8|5+0&#ffd7d7255|5+0&#ffffff0| @44
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
 |:| @40|5|,|1|-|5|7| @7|A|l@1| 
--- a/src/testdir/dumps/Test_prop_above_below_empty_4.dump
+++ b/src/testdir/dumps/Test_prop_above_below_empty_4.dump
@@ -1,16 +1,16 @@
-| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|4| |1+0#0000000&@7| @47
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|3| | +0#0000000&@55
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|2| |3+0#0000000&@8| @46
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|1| | +0#0000000&@55
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 |5+0#af5f00255&| @2>5+0#0000000&@10| @44
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
 |:| @40|5|,|1|-|5|7| @7|A|l@1| 
--- a/src/testdir/dumps/Test_prop_above_below_empty_5.dump
+++ b/src/testdir/dumps/Test_prop_above_below_empty_5.dump
@@ -1,16 +1,16 @@
-| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255#ffffff0@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|2| |1+0#0000000&@7| @47
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|1| | +0#0000000&@55
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 |3+0#af5f00255&| @2>3+0#0000000&@8| @46
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|1| | +0#0000000&@55
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
-| +0#af5f00255&@3|-+0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
+| +0#af5f00255&@3|-+0#0000001#ffff4012| +0#0000000#ffffff0@54
 | +0#af5f00255&@1|2| |5+0#0000000&@10| @44
-| +0#af5f00255&@3|++0#0000001#ffff4012@2| +0#0000000#ffffff0@52
+| +0#af5f00255&@3|++0#0000001#ffff4012| +0#0000000#ffffff0@54
 |:| @40|3|,|1|-|5|7| @7|A|l@1| 
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -3075,8 +3075,9 @@ func Test_prop_with_text_above_below_emp
       let vt = 'test'
       call prop_type_add(vt, {'highlight': 'ToDo'})
       for ln in range(1, line('$'))
-        call prop_add(ln, 0, {'type': vt, 'text': '---', 'text_align': 'above'})
-        call prop_add(ln, 0, {'type': vt, 'text': '+++', 'text_align': 'below'})
+        " use 1 character text to test for off-by-one regressions
+        call prop_add(ln, 0, {'type': vt, 'text': '-', 'text_align': 'above'})
+        call prop_add(ln, 0, {'type': vt, 'text': '+', 'text_align': 'below'})
       endfor
       normal G
   END
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    140,
+/**/
     139,
 /**/
     138,