Patch 9.0.0357

4 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 2, 2022, 8:27:19 AM9/2/22
to vim...@googlegroups.com

Patch 9.0.0357
Problem: 'linebreak' interferes with text property highlight if there is
syntax highlighting.
Solution: Check the text prop attributes after combining with syntax
attributes. (closes #11035)
Files: src/drawline.c, src/testdir/test_textprop.vim,
src/testdir/dumps/Test_prop_linebreak.dump,
src/testdir/dumps/Test_prop_linebreak_1.dump,
src/testdir/dumps/Test_prop_linebreak_2.dump


*** ../vim-9.0.0356/src/drawline.c 2022-08-28 16:38:57.408641746 +0100
--- src/drawline.c 2022-09-02 13:25:06.592578833 +0100
***************
*** 612,617 ****
--- 612,619 ----
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_attr_comb = 0; // text_prop_attr combined with
+ // syntax_attr
int text_prop_id = 0; // active property ID
int text_prop_flags = 0;
int text_prop_follows = FALSE; // another text prop to display
***************
*** 1676,1682 ****
--pi;
# ifdef FEAT_LINEBREAK
// not exactly right but should work in most cases
! if (in_linebreak && syntax_attr == text_prop_attr)
syntax_attr = 0;
# endif
}
--- 1678,1684 ----
--pi;
# ifdef FEAT_LINEBREAK
// not exactly right but should work in most cases
! if (in_linebreak && syntax_attr == text_prop_attr_comb)
syntax_attr = 0;
# endif
}
***************
*** 1716,1721 ****
--- 1718,1724 ----
if (wlv.n_extra == 0 || !extra_for_textprop)
{
text_prop_attr = 0;
+ text_prop_attr_comb = 0;
text_prop_flags = 0;
text_prop_type = NULL;
text_prop_id = 0;
***************
*** 1789,1794 ****
--- 1792,1798 ----
saved_search_attr = search_attr;
search_attr = 0; // restore when n_extra is zero
text_prop_attr = 0;
+ text_prop_attr_comb = 0;
if (*ptr == NUL)
// don't combine char attr after EOL
text_prop_flags &= ~PT_FLAG_COMBINE;
***************
*** 1974,1979 ****
--- 1978,1984 ----
syntax_attr = hl_combine_attr(syntax_attr, text_prop_attr);
else
syntax_attr = text_prop_attr;
+ text_prop_attr_comb = syntax_attr;
}
# endif
#endif
*** ../vim-9.0.0356/src/testdir/test_textprop.vim 2022-09-01 12:22:19.751659183 +0100
--- src/testdir/test_textprop.vim 2022-09-02 13:19:36.273388313 +0100
***************
*** 1925,1936 ****
let lines =<< trim END
set breakindent linebreak breakat+=]
call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
! call prop_type_add('test', #{highlight: 'ErrorMsg'})
call prop_add(1, 51, #{length: 1, type: 'test'})
END
call writefile(lines, 'XscriptPropLinebreak')
let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10})
! call VerifyScreenDump(buf, 'Test_prop_linebreak', {})

call StopVimInTerminal(buf)
call delete('XscriptPropLinebreak')
--- 1925,1945 ----
let lines =<< trim END
set breakindent linebreak breakat+=]
call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
! call prop_type_add('test', #{highlight: 'MatchParen'})
call prop_add(1, 51, #{length: 1, type: 'test'})
+ func AddMatch()
+ syntax on
+ syntax match xTest /.*/
+ hi link xTest Comment
+ set signcolumn=yes
+ endfunc
END
call writefile(lines, 'XscriptPropLinebreak')
let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10})
! call VerifyScreenDump(buf, 'Test_prop_linebreak_1', {})
!
! call term_sendkeys(buf, ":call AddMatch()\<CR>")
! call VerifyScreenDump(buf, 'Test_prop_linebreak_2', {})

call StopVimInTerminal(buf)
call delete('XscriptPropLinebreak')
*** ../vim-9.0.0356/src/testdir/dumps/Test_prop_linebreak.dump 2021-11-29 21:08:53.000000000 +0000
--- src/testdir/dumps/Test_prop_linebreak.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,10 ****
- >x+0&#ffffff0@49|]+0#ffffff16#e000002| +0#0000000#ffffff0@23
- |x@69| @4
- |~+0#4040ff13&| @73
- |~| @73
- |~| @73
- |~| @73
- |~| @73
- |~| @73
- |~| @73
- | +0#0000000&@56|1|,|1| @10|A|l@1|
--- 0 ----
*** ../vim-9.0.0356/src/testdir/dumps/Test_prop_linebreak_1.dump 2022-09-02 13:25:33.184519033 +0100
--- src/testdir/dumps/Test_prop_linebreak_1.dump 2022-09-02 13:20:22.989264635 +0100
***************
*** 0 ****
--- 1,10 ----
+ >x+0&#ffffff0@49|]+0&#40ffff15| +0&#ffffff0@23
+ |x@69| @4
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|1|,|1| @10|A|l@1|
*** ../vim-9.0.0356/src/testdir/dumps/Test_prop_linebreak_2.dump 2022-09-02 13:25:33.188519024 +0100
--- src/testdir/dumps/Test_prop_linebreak_2.dump 2022-09-02 13:20:24.145261621 +0100
***************
*** 0 ****
--- 1,10 ----
+ | +0#0000e05#a8a8a8255@1>x+0&#ffffff0@49|]+0&#40ffff15| +0#0000000#ffffff0@21
+ | +0#0000e05#a8a8a8255@1|x+0&#ffffff0@69| +0#0000000&@2
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|1|,|1| @10|A|l@1|
*** ../vim-9.0.0356/src/version.c 2022-09-02 12:16:01.876714257 +0100
--- src/version.c 2022-09-02 13:25:21.084546165 +0100
***************
*** 709,710 ****
--- 709,712 ----
{ /* Add new patch number below this line */
+ /**/
+ 357,
/**/

--
If you had to identify, in one word, the reason why the
human race has not achieved, and never will achieve, its
full potential, that word would be "meetings."

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages