diff options
author | Dylan Thacker-Smith <dylan.ah.smith@gmail.com> | 2024-02-21 21:00:59 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-02-21 21:00:59 +0100 |
commit | 8055721c2d30f21cfabe7453014f526e7becfc06 (patch) | |
tree | 4e6d72393c68879f95ccdc4a7ee8513dc4fc7294 /src/testdir/test_textprop.vim | |
parent | ec9c32637f566f38d097c566209d85d697182153 (diff) |
patch 9.1.0124: display of below/right virtual text with non-virtual text overlapv9.1.0124
Problem: Virtual text with text_align 'right'/'below' wasn't being
used when a non-virtual text property overlaps with the end of
the line. This was because the non-virtual text property had a
higher priority, preventing the virtual text from being used.
Solution: Fix the sorting of text properties so virtual text properties
have a higher priority than non-virtual text properties.
(Dylan Thacker-Smith)
related: #14063
Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r-- | src/testdir/test_textprop.vim | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 97fea60e6d..18ff3df2ee 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -4090,6 +4090,46 @@ func Test_text_below_nowrap() call StopVimInTerminal(buf) endfunc +func Test_virtual_text_overlap_with_highlight() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + setline(1, ['one', 'two', 'three', 'four', 'five']) + set number + + prop_type_add('demo_highlight_warning', {highlight: 'WarningMsg'}) + prop_type_add('demo_virtual_text_error', {highlight: 'Error'}) + + prop_add(2, 4, { + type: 'demo_highlight_warning', + end_col: 4, + }) + prop_add(2, 0, { + type: 'demo_virtual_text_error', + text: 'syntax error', + text_align: 'below', + }) + normal 2j + + prop_add(4, 4, { + type: 'demo_highlight_warning', + end_lnum: 5, + end_col: 1, + }) + prop_add(4, 0, { + type: 'demo_virtual_text_error', + text: 'other error', + text_align: 'right', + }) + END + call writefile(lines, 'XVirtualTextOverlapWithHighlight', 'D') + let buf = RunVimInTerminal('-S XVirtualTextOverlapWithHighlight', #{rows: 8, cols: 60}) + call VerifyScreenDump(buf, 'Test_virtual_text_overlap_with_highlight_1', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_virtual_text_in_popup_highlight() CheckRunVimInTerminal |