Patch 9.0.0208
Problem:    The override flag has no effect for virtual text. (Ben Jackson)
Solution:   Make the override flag work. (closes #10915)
Files:      src/drawline.c, src/testdir/test_textprop.vim,
            src/testdir/dumps/Test_prop_with_text_override_1.dump,
            src/testdir/dumps/Test_prop_with_text_override_2.dump


*** ../vim-9.0.0207/src/drawline.c      2022-08-13 20:17:31.250884273 +0100
--- src/drawline.c      2022-08-14 16:34:42.654246801 +0100
***************
*** 554,559 ****
--- 554,560 ----
      int               *text_prop_idxs = NULL;
      int               text_props_active = 0;
      proptype_T  *text_prop_type = NULL;
+     int               extra_for_textprop = FALSE; // wlv.n_extra set for 
textprop
      int               text_prop_attr = 0;
      int               text_prop_id = 0;       // active property ID
      int               text_prop_flags = 0;
***************
*** 1645,1654 ****
                    ++text_prop_next;
                }
  
!               text_prop_attr = 0;
!               text_prop_flags = 0;
!               text_prop_type = NULL;
!               text_prop_id = 0;
                if (text_props_active > 0 && wlv.n_extra == 0)
                {
                    int used_tpi = -1;
--- 1646,1658 ----
                    ++text_prop_next;
                }
  
!               if (wlv.n_extra == 0 || !extra_for_textprop)
!               {
!                   text_prop_attr = 0;
!                   text_prop_flags = 0;
!                   text_prop_type = NULL;
!                   text_prop_id = 0;
!               }
                if (text_props_active > 0 && wlv.n_extra == 0)
                {
                    int used_tpi = -1;
***************
*** 1709,1714 ****
--- 1713,1719 ----
                            wlv.c_extra = NUL;
                            wlv.c_final = NUL;
                            wlv.n_extra = (int)STRLEN(p);
+                           extra_for_textprop = TRUE;
                            extra_attr = used_attr;
                            n_attr = mb_charlen(p);
                            saved_search_attr = search_attr;
***************
*** 2094,2099 ****
--- 2099,2105 ----
  #if defined(FEAT_PROP_POPUP)
            if (wlv.n_extra <= 0)
            {
+               extra_for_textprop = FALSE;
                in_linebreak = FALSE;
                if (search_attr == 0)
                    search_attr = saved_search_attr;
***************
*** 2982,2992 ****
        }
  #endif
  
!       // Use "extra_attr", but don't override visual selection highlighting.
        // Don't use "extra_attr" until n_attr_skip is zero.
        if (n_attr_skip == 0 && n_attr > 0
                && wlv.draw_state == WL_LINE
!               && !attr_pri)
        {
  #ifdef LINE_ATTR
            if (line_attr)
--- 2988,2999 ----
        }
  #endif
  
!       // Use "extra_attr", but don't override visual selection highlighting,
!       // unless text property overrides.
        // Don't use "extra_attr" until n_attr_skip is zero.
        if (n_attr_skip == 0 && n_attr > 0
                && wlv.draw_state == WL_LINE
!               && (!attr_pri || (text_prop_flags & PT_FLAG_OVERRIDE)))
        {
  #ifdef LINE_ATTR
            if (line_attr)
*** ../vim-9.0.0207/src/testdir/test_textprop.vim       2022-08-14 
13:28:36.223224725 +0100
--- src/testdir/test_textprop.vim       2022-08-14 16:30:56.342691969 +0100
***************
*** 2805,2810 ****
--- 2805,2834 ----
    call delete('XscriptPropsBelowNowrap')
  endfunc
  
+ func Test_props_with_text_override()
+   CheckRunVimInTerminal
+ 
+   let lines =<< trim END
+       vim9script
+       setline(1, 'some text here')
+       hi Likethis ctermfg=blue ctermbg=cyan
+       prop_type_add('prop', {highlight: 'Likethis', override: true})
+       prop_add(1, 6, {type: 'prop', text: ' inserted '})
+       hi CursorLine cterm=underline ctermbg=lightgrey
+       set cursorline
+   END
+   call writefile(lines, 'XscriptPropsOverride')
+   let buf = RunVimInTerminal('-S XscriptPropsOverride', #{rows: 6, cols: 60})
+   call VerifyScreenDump(buf, 'Test_prop_with_text_override_1', {})
+ 
+   call term_sendkeys(buf, ":set nocursorline\<CR>")
+   call term_sendkeys(buf, "0llvfr")
+   call VerifyScreenDump(buf, 'Test_prop_with_text_override_2', {})
+ 
+   call StopVimInTerminal(buf)
+   call delete('XscriptPropsOverride')
+ endfunc
+ 
  func Test_props_with_text_CursorMoved()
    CheckRunVimInTerminal
  
*** ../vim-9.0.0207/src/testdir/dumps/Test_prop_with_text_override_1.dump       
2022-08-14 16:34:01.662328901 +0100
--- src/testdir/dumps/Test_prop_with_text_override_1.dump       2022-08-14 
16:32:26.174517787 +0100
***************
*** 0 ****
--- 1,6 ----
+ >s+8&#e0e0e08|o|m|e| | +8#4040ff13#40ffff15|i|n|s|e|r|t|e|d| 
|t+8#0000000#e0e0e08|e|x|t| |h|e|r|e| @35
+ |~+0#4040ff13#ffffff0| @58
+ |~| @58
+ |~| @58
+ |~| @58
+ | +0#0000000&@41|1|,|1| @10|A|l@1| 
*** ../vim-9.0.0207/src/testdir/dumps/Test_prop_with_text_override_2.dump       
2022-08-14 16:34:01.670328886 +0100
--- src/testdir/dumps/Test_prop_with_text_override_2.dump       2022-08-14 
16:32:27.330515522 +0100
***************
*** 0 ****
--- 1,6 ----
+ |s+0&#ffffff0|o|m+0&#e0e0e08|e| | +0#4040ff13#40ffff15|i|n|s|e|r|t|e|d| 
|t+0#0000000#e0e0e08|e|x|t| |h|e>r+0&#ffffff0|e| @35
+ |~+0#4040ff13&| @58
+ |~| @58
+ |~| @58
+ |~| @58
+ |-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@19|1@1| @7|1|,|1|3|-|2|3| @6|A|l@1| 
*** ../vim-9.0.0207/src/version.c       2022-08-14 14:49:46.351601248 +0100
--- src/version.c       2022-08-14 16:32:17.478534807 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     208,
  /**/

-- 
Overflow on /dev/null, please empty the bit bucket.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220814153709.2A1861C04B1%40moolenaar.net.

Raspunde prin e-mail lui