fix(folds): show Folded highlight in Visual selection (#23741)

Note: CursorLine highlight is now combined with Folded.
This commit is contained in:
zeertzjq
2023-05-24 21:25:39 +08:00
committed by GitHub
parent c855eee919
commit 678548a2b4
3 changed files with 71 additions and 16 deletions

View File

@@ -42,7 +42,9 @@ describe("folded lines", function()
[9] = {bold = true, foreground = Screen.colors.Brown},
[10] = {background = Screen.colors.LightGrey, underline = true},
[11] = {bold=true},
[12] = {background = Screen.colors.Grey90},
[12] = {background = Screen.colors.Grey90, underline = true},
[13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey, underline = true},
[14] = {background = Screen.colors.LightGray},
})
end)
@@ -86,9 +88,10 @@ describe("folded lines", function()
end
end)
it("highlights with CursorLineFold when 'cursorline' is set", function()
it("foldcolumn highlighted with CursorLineFold when 'cursorline' is set", function()
command("set number cursorline foldcolumn=2")
command("hi link CursorLineFold Search")
command("hi! CursorLine gui=underline guibg=Grey90")
insert(content1)
feed("ggzf3jj")
if multigrid then
@@ -138,7 +141,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
{6:+ }{9: 1 }{12:^+-- 4 lines: This is a················}|
{6:+ }{9: 1 }{13:^+-- 4 lines: This is a················}|
{7: }{8: 5 }in his cave. |
{7: }{8: 6 } |
{1:~ }|
@@ -150,7 +153,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
{6:+ }{9: 1 }{12:^+-- 4 lines: This is a················}|
{6:+ }{9: 1 }{13:^+-- 4 lines: This is a················}|
{7: }{8: 5 }in his cave. |
{7: }{8: 6 } |
{1:~ }|
@@ -179,7 +182,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
{7:+ }{8: 1 }{12:^+-- 4 lines: This is a················}|
{7:+ }{8: 1 }{13:^+-- 4 lines: This is a················}|
{7: }{8: 5 }in his cave. |
{7: }{8: 6 } |
{1:~ }|
@@ -191,7 +194,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
{7:+ }{8: 1 }{12:^+-- 4 lines: This is a················}|
{7:+ }{8: 1 }{13:^+-- 4 lines: This is a················}|
{7: }{8: 5 }in his cave. |
{7: }{8: 6 } |
{1:~ }|
@@ -2013,6 +2016,56 @@ describe("folded lines", function()
]])
end
end)
it('Folded highlight does not disappear in Visual selection #19691', function()
insert([[
" foo
" {{{1
set nocp
" }}}1
" bar
" {{{1
set foldmethod=marker
" }}}1
" baz]])
feed('gg')
command('source')
feed('<C-V>G3l')
if multigrid then
screen:expect([[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
{14:" fo}o |
{5:+-- 3 lines: "······························}|
{14:" ba}r |
{5:+-- 3 lines: "······························}|
{14:" b}^az |
{1:~ }|
{1:~ }|
## grid 3
{11:-- VISUAL BLOCK --} |
]])
else
screen:expect([[
{14:" fo}o |
{5:+-- 3 lines: "······························}|
{14:" ba}r |
{5:+-- 3 lines: "······························}|
{14:" b}^az |
{1:~ }|
{1:~ }|
{11:-- VISUAL BLOCK --} |
]])
end
end)
end
describe("with ext_multigrid", function()