Patch 9.0.0144
Problem:    Text property cannot override 'cursorline' highlight.
Solution:   Add the "override" flag to prop_type_add(). (closes #5533,
            closes #8225).
Files:      runtime/doc/textprop.txt, src/textprop.c, src/structs.h,
            src/testdir/test_textprop.vim,
            src/testdir/dumps/Test_textprop_hl_override_1.dump,
            src/testdir/dumps/Test_textprop_hl_override_2.dump


*** ../vim-9.0.0143/runtime/doc/textprop.txt    2022-08-01 16:11:02.656646804 
+0100
--- runtime/doc/textprop.txt    2022-08-05 17:04:08.390951283 +0100
***************
*** 377,382 ****
--- 377,384 ----
                   combine      when omitted or TRUE combine the highlight
                                with any syntax highlight; when FALSE syntax
                                highlight will not be used
+                  override     when TRUE the highlight overrides any other,
+                               including 'cursorline' and Visual
                   start_incl   when TRUE inserts at the start position will
                                be included in the text property
                   end_incl     when TRUE inserts at the end position will be
*** ../vim-9.0.0143/src/textprop.c      2022-08-01 22:18:30.483764954 +0100
--- src/textprop.c      2022-08-05 16:20:02.185459397 +0100
***************
*** 238,246 ****
            goto theend;
        ((char_u **)gap->ga_data)[gap->ga_len++] = text;
  
!       // change any Tab to a Space to make it simpler to compute the size
        for (p = text; *p != NUL; MB_PTR_ADV(p))
!           if (*p == TAB)
                *p = ' ';
        text = NULL;
      }
--- 238,247 ----
            goto theend;
        ((char_u **)gap->ga_data)[gap->ga_len++] = text;
  
!       // change any control character (Tab, Newline, etc.) to a Space to make
!       // it simpler to compute the size
        for (p = text; *p != NUL; MB_PTR_ADV(p))
!           if (*p < ' ')
                *p = ' ';
        text = NULL;
      }
***************
*** 1542,1547 ****
--- 1543,1557 ----
                prop->pt_flags &= ~PT_FLAG_COMBINE;
        }
  
+       di = dict_find(dict, (char_u *)"override", -1);
+       if (di != NULL)
+       {
+           if (tv_get_bool(&di->di_tv))
+               prop->pt_flags |= PT_FLAG_OVERRIDE;
+           else
+               prop->pt_flags &= ~PT_FLAG_OVERRIDE;
+       }
+ 
        di = dict_find(dict, (char_u *)"priority", -1);
        if (di != NULL)
            prop->pt_priority = tv_get_number(&di->di_tv);
*** ../vim-9.0.0143/src/structs.h       2022-08-04 15:03:16.253142105 +0100
--- src/structs.h       2022-08-05 16:20:21.621420175 +0100
***************
*** 834,839 ****
--- 834,840 ----
  #define PT_FLAG_INS_START_INCL        1       // insert at start included in 
property
  #define PT_FLAG_INS_END_INCL  2       // insert at end included in property
  #define PT_FLAG_COMBINE               4       // combine with syntax highlight
+ #define PT_FLAG_OVERRIDE      8       // override any highlight
  
  // Sign group
  typedef struct signgroup_S
*** ../vim-9.0.0143/src/testdir/test_textprop.vim       2022-08-05 
13:06:51.619363752 +0100
--- src/testdir/test_textprop.vim       2022-08-05 16:46:08.731206545 +0100
***************
*** 1133,1138 ****
--- 1133,1170 ----
    call delete('XtestProp')
  endfunc
  
+ func Test_textprop_hl_override()
+   CheckScreendump
+ 
+   let lines =<< trim END
+       call setline(1, ['One one one one one', 'Two two two two two', 'Three 
three three three'])
+       hi OverProp ctermfg=blue ctermbg=yellow
+       hi CursorLine cterm=bold,underline ctermfg=red ctermbg=green
+       hi Vsual ctermfg=cyan ctermbg=grey
+       call prop_type_add('under', #{highlight: 'OverProp'})
+       call prop_type_add('over', #{highlight: 'OverProp', override: 1})
+       call prop_add(1, 5, #{type: 'under', length: 4})
+       call prop_add(1, 13, #{type: 'over', length: 4})
+       call prop_add(2, 5, #{type: 'under', length: 4})
+       call prop_add(2, 13, #{type: 'over', length: 4})
+       call prop_add(3, 5, #{type: 'under', length: 4})
+       call prop_add(3, 13, #{type: 'over', length: 4})
+       set cursorline
+       2
+   END
+   call writefile(lines, 'XtestOverProp')
+   let buf = RunVimInTerminal('-S XtestOverProp', {'rows': 8})
+   call VerifyScreenDump(buf, 'Test_textprop_hl_override_1', {})
+ 
+   call term_sendkeys(buf, "3Gllv$hh")
+   call VerifyScreenDump(buf, 'Test_textprop_hl_override_2', {})
+   call term_sendkeys(buf, "\<Esc>")
+ 
+   " clean up
+   call StopVimInTerminal(buf)
+   call delete('XtestOverProp')
+ endfunc
+ 
  func RunTestVisualBlock(width, dump)
    call writefile([
        \ "call setline(1, ["
*** ../vim-9.0.0143/src/testdir/dumps/Test_textprop_hl_override_1.dump  
2022-08-05 17:04:24.142934945 +0100
--- src/testdir/dumps/Test_textprop_hl_override_1.dump  2022-08-05 
16:46:15.007214831 +0100
***************
*** 0 ****
--- 1,8 ----
+ |O+0&#ffffff0|n|e| |o+0#4040ff13#ffff4012|n|e| |o+0#0000000#ffffff0|n|e| 
|o+0#4040ff13#ffff4012|n|e| |o+0#0000000#ffffff0|n|e| @55
+ >T+10#ff404010#40ff4011|w|o| |t|w|o| |t|w|o| |t+10#4040ff13#ffff4012|w|o| 
|t+10#ff404010#40ff4011|w|o| @55
+ |T+0#0000000#ffffff0|h|r|e|e+0#4040ff13#ffff4012| 
|t|h|r+0#0000000#ffffff0|e@1| |t+0#4040ff13#ffff4012|h|r|e|e+0#0000000#ffffff0| 
|t|h|r|e@1| @51
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|2|,|1| @10|A|l@1| 
*** ../vim-9.0.0143/src/testdir/dumps/Test_textprop_hl_override_2.dump  
2022-08-05 17:04:24.146934942 +0100
--- src/testdir/dumps/Test_textprop_hl_override_2.dump  2022-08-05 
16:46:16.159216329 +0100
***************
*** 0 ****
--- 1,8 ----
+ |O+0&#ffffff0|n|e| |o+0#4040ff13#ffff4012|n|e| |o+0#0000000#ffffff0|n|e| 
|o+0#4040ff13#ffff4012|n|e| |o+0#0000000#ffffff0|n|e| @55
+ |T|w|o| |t+0#4040ff13#ffff4012|w|o| |t+0#0000000#ffffff0|w|o| 
|t+0#4040ff13#ffff4012|w|o| |t+0#0000000#ffffff0|w|o| @55
+ |T|h|r+0&#e0e0e08|e|e+0#4040ff13&| |t|h|r+0#0000000&|e@1| 
|t+0#4040ff13#ffff4012|h|r|e|e+0#0000000#e0e0e08| |t|h|r>e+0&#ffffff0@1| @51
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@34|2|0| @7|3|,|2@1| @9|A|l@1| 
*** ../vim-9.0.0143/src/version.c       2022-08-05 13:06:51.623363742 +0100
--- src/version.c       2022-08-05 16:49:18.663376105 +0100
***************
*** 737,738 ****
--- 737,740 ----
  {   /* Add new patch number below this line */
+ /**/
+     144,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
243. You unsuccessfully try to download a pizza from www.dominos.com.

 /// 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/20220805161308.438CF1C0EC3%40moolenaar.net.

Raspunde prin e-mail lui