]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0944: 'cursorline' causes virtual text highlight to continue v9.0.0944
authorBram Moolenaar <Bram@vim.org>
Thu, 24 Nov 2022 22:42:29 +0000 (22:42 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 24 Nov 2022 22:42:29 +0000 (22:42 +0000)
Problem:    'cursorline' causes virtual text highlight to continue.
Solution:   Save and restore line_attr. (closes #11588)

src/drawline.c
src/testdir/dumps/Test_prop_with_text_after_below_trunc_1.dump
src/testdir/dumps/Test_prop_with_text_after_below_trunc_2.dump
src/testdir/dumps/Test_prop_with_text_after_below_trunc_3.dump [new file with mode: 0644]
src/testdir/test_textprop.vim
src/version.c

index c1ff24c73eef316e169368f33f66979386a45adc..e6fdd7a0bd898e070d190d99cc54fdff1b12ed78 100644 (file)
@@ -948,6 +948,7 @@ win_line_continue(winlinevars_T *wlv)
     {
        // Continue item from end of wrapped line.
        wlv->n_extra = wlv->saved_n_extra;
+       wlv->saved_n_extra = 0;
        wlv->c_extra = wlv->saved_c_extra;
        wlv->c_final = wlv->saved_c_final;
        wlv->p_extra = wlv->saved_p_extra;
@@ -1046,6 +1047,7 @@ win_line(
     int                saved_search_attr = 0;  // search_attr to be used when n_extra
                                        // goes to zero
     int                saved_area_attr = 0;    // idem for area_attr
+    int                reset_extra_attr = FALSE;
 #endif
 #ifdef FEAT_SPELL
     int                has_spell = FALSE;      // this buffer has spell checking
@@ -1919,6 +1921,7 @@ win_line(
                    text_prop_flags = 0;
                    text_prop_type = NULL;
                    text_prop_id = 0;
+                   reset_extra_attr = FALSE;
                }
                if (text_props_active > 0 && wlv.n_extra == 0)
                {
@@ -2403,14 +2406,17 @@ win_line(
                wlv.extra_for_textprop = FALSE;
                in_linebreak = FALSE;
 
-               // only restore search_attr and area_attr after extra in the
-               // next screen line is also done
+               // Only restore search_attr and area_attr after "n_extra" in
+               // the next screen line is also done.
                if (wlv.saved_n_extra <= 0)
                {
                    if (search_attr == 0)
                        search_attr = saved_search_attr;
                    if (area_attr == 0 && *ptr != NUL)
                        area_attr = saved_area_attr;
+                   // wlv.extra_attr should be used at this position but not
+                   // any further.
+                   reset_extra_attr = TRUE;
                }
            }
 #endif
@@ -3317,6 +3323,13 @@ win_line(
            else
 #endif
                wlv.char_attr = wlv.extra_attr;
+#ifdef FEAT_PROP_POPUP
+           if (reset_extra_attr)
+           {
+               reset_extra_attr = FALSE;
+               wlv.extra_attr = 0;
+           }
+#endif
        }
 
 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
index e254ac034eb88489bd37d7fbbbd732428bf0ef58..8481c9c743e88420bb4f8888347bd4735c9a4ffc 100644 (file)
@@ -1,5 +1,5 @@
 |o+0&#ffffff0|n|a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d| |f|a|s| |d|f|t+0#e000e06&|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|…
-|t|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0#0000000&@16
+| +0#0000000&@3|t+0&#ffd7ff255|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0&#ffffff0@12
 |t|w>o| @56
 |~+0#4040ff13&| @58
 |~| @58
index 1d93f9fb42dc14a0bce08d84d4e1040f04af4480..afa1a3624f5b6fe7c100e68b18d2c852df505a37 100644 (file)
@@ -1,5 +1,5 @@
 | +0#af5f00255#ffffff0@1|1| |o+0#0000000&|n|a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d| |f|a|s| |d|f|t+0#e000e06&|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|…
-| +0#af5f00255&@3|t+0#e000e06&|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0#0000000&@12
+| +0#af5f00255&@3| +0#0000000&@3|t+0&#ffd7ff255|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0&#ffffff0@8
 | +0#af5f00255&@1|2| |t+0#0000000&|w>o| @52
 |~+0#4040ff13&| @58
 |~| @58
diff --git a/src/testdir/dumps/Test_prop_with_text_after_below_trunc_3.dump b/src/testdir/dumps/Test_prop_with_text_after_below_trunc_3.dump
new file mode 100644 (file)
index 0000000..7b93c7f
--- /dev/null
@@ -0,0 +1,8 @@
+| +8#af5f00255#ffffff0@1|1| >o+8#0000000&|n|a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d|f| |a|s|d| |f|a|s| |d|f|t+8#e000e06&|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|…
+| +8#af5f00255&@3| +8#0000000&@3|t+8&#ffd7ff255|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +8&#ffffff0@8
+| +0#af5f00255&@1|2| |t+0#0000000&|w|o| @52
+|~+0#4040ff13&| @58
+|~| @58
+|~| @58
+|~| @58
+|:+0#0000000&|s|e|t| |c|u|r|s|o|r|l|i|n|e| @26|1|,|1| @10|A|l@1| 
index c2ee233e3211cf08618ec1dc1efa0da89ebe4733..3f24463c184bca13970c818a75f704abd88e6c47 100644 (file)
@@ -2690,12 +2690,14 @@ func Test_props_with_text_after_below_trunc()
       prop_add(1, 0, {
           type: 'test',
           text: 'the quick brown fox jumps over the lazy dog',
-          text_align: 'after'
+          text_align: 'after',
       })
+      prop_type_add('another', {highlight: 'DiffChange'})
       prop_add(1, 0, {
-          type: 'test',
+          type: 'another',
           text: 'the quick brown fox jumps over the lazy dog',
-          text_align: 'below'
+          text_align: 'below',
+          text_padding_left: 4,
       })
       normal G$
   END
@@ -2706,6 +2708,9 @@ func Test_props_with_text_after_below_trunc()
   call term_sendkeys(buf, ":set number\<CR>")
   call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_2', {})
 
+  call term_sendkeys(buf, ":set cursorline\<CR>gg")
+  call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_3', {})
+
   call StopVimInTerminal(buf)
 endfunc
 
index f602fe34728088e9c65ff38d321dcd0fc64f4dfe..b234cce90b02d985186aa1d5c45ae50eed9fce7f 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    944,
 /**/
     943,
 /**/