From 0e01e815520ead73b13277b68306cf03a2196ca5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 3 Jun 2023 18:44:08 +0800 Subject: fix(folds): allow overlay virtual text on folded line (#23892) Also always check for fi_level before fi_lines. --- test/functional/ui/decorations_spec.lua | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'test') diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 54441984a3..cbf0178d28 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -666,6 +666,7 @@ describe('extmark decorations', function() [30] = {foreground = Screen.colors.DarkCyan, background = Screen.colors.LightGray, underline = true}; [31] = {underline = true, foreground = Screen.colors.DarkCyan}; [32] = {underline = true}; + [33] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGray}; } ns = meths.create_namespace 'test' @@ -1147,6 +1148,46 @@ describe('extmark decorations', function() ]]} end) + it('can have virtual text on folded line', function() + insert([[ + 11111 + 22222 + 33333]]) + command('1,2fold') + command('set nowrap') + screen:try_resize(50, 3) + feed('zb') + -- XXX: the behavior of overlay virtual text at non-zero column is strange: + -- 1. With 'wrap' it is never shown. + -- 2. With 'nowrap' it is shown only if the extmark is hidden before leftcol. + meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{'AA', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'overlay' }) + meths.buf_set_extmark(0, ns, 0, 1, { virt_text = {{'BB', 'Underlined'}}, hl_mode = 'combine', virt_text_win_col = 10 }) + meths.buf_set_extmark(0, ns, 0, 2, { virt_text = {{'CC', 'Underlined'}}, hl_mode = 'combine', virt_text_pos = 'right_align' }) + screen:expect{grid=[[ + {29:AA}{33:- 2 lin}{29:BB}{33:: 11111·····························}{29:CC}| + 3333^3 | + | + ]]} + feed('zl') + screen:expect{grid=[[ + {29:AA}{33:- 2 lin}{29:BB}{33:: 11111·····························}{29:CC}| + 333^3 | + | + ]]} + feed('zl') + screen:expect{grid=[[ + {29:AA}{33:- 2 lin}{29:BB}{33:: 11111·····························}{29:CC}| + 33^3 | + | + ]]} + feed('zl') + screen:expect{grid=[[ + {29:AA}{33:- 2 lin}{29:BB}{33:: 11111·····························}{29:CC}| + 3^3 | + | + ]]} + end) + it('can have virtual text which combines foreground and background groups', function() screen:set_default_attr_ids { [1] = {bold=true, foreground=Screen.colors.Blue}; -- cgit