aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/fold_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /test/functional/ui/fold_spec.lua
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.gz
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.bz2
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'test/functional/ui/fold_spec.lua')
-rw-r--r--test/functional/ui/fold_spec.lua1306
1 files changed, 1197 insertions, 109 deletions
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua
index 46a478c1ea..1addf7088e 100644
--- a/test/functional/ui/fold_spec.lua
+++ b/test/functional/ui/fold_spec.lua
@@ -4,11 +4,9 @@ local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq
local command = helpers.command
local feed_command = helpers.feed_command
local insert = helpers.insert
-local expect = helpers.expect
local funcs = helpers.funcs
local meths = helpers.meths
local exec = helpers.exec
-local exec_lua = helpers.exec_lua
local assert_alive = helpers.assert_alive
@@ -29,23 +27,29 @@ describe("folded lines", function()
local function with_ext_multigrid(multigrid)
local screen
before_each(function()
- clear()
- command('hi VertSplit gui=reverse')
screen = Screen.new(45, 8)
screen:attach({rgb=true, ext_multigrid=multigrid})
screen:set_default_attr_ids({
[1] = {bold = true, foreground = Screen.colors.Blue1},
[2] = {reverse = true},
[3] = {bold = true, reverse = true},
- [4] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
+ [4] = {foreground = Screen.colors.White, background = Screen.colors.Red},
[5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
[6] = {background = Screen.colors.Yellow},
[7] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
[8] = {foreground = Screen.colors.Brown },
[9] = {bold = true, foreground = Screen.colors.Brown},
[10] = {background = Screen.colors.LightGrey, underline = true},
- [11] = {bold=true},
- [12] = {background = Screen.colors.Grey90},
+ [11] = {bold = true},
+ [12] = {foreground = Screen.colors.Red},
+ [13] = {foreground = Screen.colors.Red, background = Screen.colors.LightGrey},
+ [14] = {background = Screen.colors.Red},
+ [15] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Red},
+ [16] = {background = Screen.colors.LightGrey},
+ [17] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red},
+ [18] = {background = Screen.colors.LightGrey, bold = true, foreground = Screen.colors.Blue},
+ [19] = {background = Screen.colors.Yellow, foreground = Screen.colors.DarkBlue},
+ [20] = {background = Screen.colors.Red, bold = true, foreground = Screen.colors.Blue},
})
end)
@@ -89,11 +93,11 @@ describe("folded lines", function()
end
end)
- it("highlights with CursorLineFold when 'cursorline' is set", function()
- command("set cursorline foldcolumn=2 foldmethod=marker")
+ local function test_folded_cursorline()
+ command("set number cursorline foldcolumn=2")
command("hi link CursorLineFold Search")
insert(content1)
- feed("zf3j")
+ feed("ggzf3jj")
if multigrid then
screen:expect([[
## grid 1
@@ -106,26 +110,26 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {7: }This is a |
- {7: }valid English |
- {7: }sentence composed by |
- {7: }an exhausted developer |
- {7: }in his cave. |
- {6: }{12:^ }|
+ {7:+ }{8: 1 }{5:+-- 4 lines: This is a················}|
+ {6: }{9: 5 }{12:^in his cave. }|
+ {7: }{8: 6 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
{1:~ }|
## grid 3
|
]])
else
screen:expect([[
- {7: }This is a |
- {7: }valid English |
- {7: }sentence composed by |
- {7: }an exhausted developer |
- {7: }in his cave. |
- {6: }{12:^ }|
- {1:~ }|
- |
+ {7:+ }{8: 1 }{5:+-- 4 lines: This is a················}|
+ {6: }{9: 5 }{12:^in his cave. }|
+ {7: }{8: 6 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]])
end
feed("k")
@@ -141,28 +145,34 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {7: }This is a |
- {7: }valid English |
- {7: }sentence composed by |
- {7: }an exhausted developer |
- {6: }{12:^in his cave. }|
- {7: } |
+ {6:+ }{9: 1 }{13:^+-- 4 lines: This is a················}|
+ {7: }{8: 5 }in his cave. |
+ {7: }{8: 6 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
{1:~ }|
## grid 3
|
]])
else
screen:expect([[
- {7: }This is a |
- {7: }valid English |
- {7: }sentence composed by |
- {7: }an exhausted developer |
- {6: }{12:^in his cave. }|
- {7: } |
- {1:~ }|
- |
+ {6:+ }{9: 1 }{13:^+-- 4 lines: This is a················}|
+ {7: }{8: 5 }in his cave. |
+ {7: }{8: 6 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]])
end
+ -- CursorLine is applied correctly with screenrow motions #22232
+ feed("jgk")
+ screen:expect_unchanged()
+ -- CursorLine is applied correctly when closing a fold when cursor is not at fold start
+ feed("zo4Gzc")
+ screen:expect_unchanged()
command("set cursorlineopt=line")
if multigrid then
screen:expect([[
@@ -176,28 +186,79 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {7: }This is a |
- {7: }valid English |
- {7: }sentence composed by |
- {7: }an exhausted developer |
- {7: }{12:^in his cave. }|
- {7: } |
+ {7:+ }{8: 1 }{13:^+-- 4 lines: This is a················}|
+ {7: }{8: 5 }in his cave. |
+ {7: }{8: 6 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
{1:~ }|
## grid 3
|
]])
else
screen:expect([[
- {7: }This is a |
- {7: }valid English |
- {7: }sentence composed by |
- {7: }an exhausted developer |
- {7: }{12:^in his cave. }|
- {7: } |
- {1:~ }|
- |
+ {7:+ }{8: 1 }{13:^+-- 4 lines: This is a················}|
+ {7: }{8: 5 }in his cave. |
+ {7: }{8: 6 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+ command("set relativenumber cursorlineopt=number")
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {6:+ }{9:1 }{5:^+-- 4 lines: This is a················}|
+ {7: }{8: 1 }in his cave. |
+ {7: }{8: 2 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]])
+ else
+ screen:expect([[
+ {6:+ }{9:1 }{5:^+-- 4 lines: This is a················}|
+ {7: }{8: 1 }in his cave. |
+ {7: }{8: 2 } |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
]])
end
+ end
+
+ describe("when 'cursorline' is set", function()
+ it('with high-priority CursorLine', function()
+ command("hi! CursorLine guibg=NONE guifg=Red gui=NONE")
+ test_folded_cursorline()
+ end)
+
+ it('with low-priority CursorLine', function()
+ command("hi! CursorLine guibg=NONE guifg=NONE gui=underline")
+ local attrs = screen:get_default_attr_ids()
+ attrs[12] = {underline = true}
+ attrs[13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey, underline = true}
+ screen:set_default_attr_ids(attrs)
+ test_folded_cursorline()
+ end)
end)
it("work with spell", function()
@@ -362,6 +423,119 @@ describe("folded lines", function()
:set norightleft |
]])
end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 2, 0, 0)
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {7:▸ }{5:^+-- 6 lines: aa···························}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ :set norightleft |
+ ]])
+ else
+ meths.input_mouse('left', 'press', '', 0, 0, 0)
+ screen:expect([[
+ {7:▸ }{5:^+-- 6 lines: aa···························}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :set norightleft |
+ ]])
+ end
+
+ -- Add a winbar to avoid double-clicks
+ command('setlocal winbar=!!!!!!')
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 2, 1, 0)
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {11:!!!!!! }|
+ {7:▾▸}{5:^+--- 5 lines: aa··························}|
+ {7:│ }ff |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ :set norightleft |
+ ]])
+ else
+ meths.input_mouse('left', 'press', '', 0, 1, 0)
+ screen:expect([[
+ {11:!!!!!! }|
+ {7:▾▸}{5:^+--- 5 lines: aa··························}|
+ {7:│ }ff |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ :set norightleft |
+ ]])
+ end
+
+ if multigrid then
+ meths.input_mouse('left', 'press', '', 2, 1, 1)
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {11:!!!!!! }|
+ {7:▾▾}^aa |
+ {7:││}bb |
+ {7:││}cc |
+ {7:││}dd |
+ {7:││}ee |
+ {7:│ }ff |
+ ## grid 3
+ :set norightleft |
+ ]])
+ else
+ meths.input_mouse('left', 'press', '', 0, 1, 1)
+ screen:expect([[
+ {11:!!!!!! }|
+ {7:▾▾}^aa |
+ {7:││}bb |
+ {7:││}cc |
+ {7:││}dd |
+ {7:││}ee |
+ {7:│ }ff |
+ :set norightleft |
+ ]])
+ end
end)
it("works with split", function()
@@ -928,9 +1102,7 @@ describe("folded lines", function()
end)
it("works with multibyte text", function()
- -- Currently the only allowed value of 'maxcombine'
- eq(6, meths.get_option('maxcombine'))
- eq(true, meths.get_option('arabicshape'))
+ eq(true, meths.get_option_value('arabicshape', {}))
insert([[
å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢͟ العَرَبِيَّة
möre text]])
@@ -946,7 +1118,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ |
+ å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ |
möre tex^t |
{1:~ }|
{1:~ }|
@@ -958,7 +1130,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ |
+ å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ |
möre tex^t |
{1:~ }|
{1:~ }|
@@ -982,7 +1154,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
+ {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -994,7 +1166,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
+ {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1018,7 +1190,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
+ {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ العَرَبِيَّة·················}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1030,7 +1202,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}|
+ {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ العَرَبِيَّة·················}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1054,7 +1226,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {7:+ }{8: 1 }{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة···········}|
+ {7:+ }{8: 1 }{5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ العَرَبِيَّة···········}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1066,7 +1238,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- {7:+ }{8: 1 }{5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة···········}|
+ {7:+ }{8: 1 }{5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ العَرَبِيَّة···········}|
{1:~ }|
{1:~ }|
{1:~ }|
@@ -1091,7 +1263,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {5:···········ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}{8: 1 }{7: +}|
+ {5:···········ةيَّبِرَعَلا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}{8: 1 }{7: +}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -1103,7 +1275,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- {5:···········ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}{8: 1 }{7: +}|
+ {5:···········ةيَّبِرَعَلا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}{8: 1 }{7: +}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -1127,7 +1299,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
+ {5:·················ةيَّبِرَعَلا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -1139,7 +1311,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
+ {5:·················ةيَّبِرَعَلا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -1163,7 +1335,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
+ {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -1175,7 +1347,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}|
+ {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}|
{1: ~}|
{1: ~}|
{1: ~}|
@@ -1199,7 +1371,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̎͂̀̂͛͛ 语 å|
+ ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å|
txet eröm|
{1: ~}|
{1: ~}|
@@ -1211,7 +1383,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̎͂̀̂͛͛ 语 å|
+ ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å|
txet eröm|
{1: ~}|
{1: ~}|
@@ -1235,7 +1407,7 @@ describe("folded lines", function()
[2:---------------------------------------------]|
[3:---------------------------------------------]|
## grid 2
- ةيَّبِرَعَ^لا x̎͂̀̂͛͛ 语 å|
+ ةيَّبِرَعَ^لا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å|
txet eröm|
{1: ~}|
{1: ~}|
@@ -1247,7 +1419,7 @@ describe("folded lines", function()
]])
else
screen:expect([[
- ةيَّبِرَعَ^لا x̎͂̀̂͛͛ 语 å|
+ ةيَّبِرَعَ^لا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å|
txet eröm|
{1: ~}|
{1: ~}|
@@ -1854,21 +2026,19 @@ describe("folded lines", function()
end
end)
- it('fold attached virtual lines are drawn correctly #21837', function()
+ it('fold attached virtual lines are drawn and scrolled correctly #21837', function()
funcs.setline(1, 'line 1')
funcs.setline(2, 'line 2')
funcs.setline(3, 'line 3')
funcs.setline(4, 'line 4')
feed("zfj")
- exec_lua([[
- local ns = vim.api.nvim_create_namespace("ns")
- vim.api.nvim_buf_set_extmark(0, ns, 0, 0, { virt_lines_above = true, virt_lines = {{{"virt_line above line 1", ""}}} })
- vim.api.nvim_buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"virt_line below line 2", ""}}} })
- vim.api.nvim_buf_set_extmark(0, ns, 2, 0, { virt_lines_above = true, virt_lines = {{{"virt_line above line 3", ""}}} })
- vim.api.nvim_buf_set_extmark(0, ns, 3, 0, { virt_lines = {{{"virt_line below line 4", ""}}} })
- ]])
+ local ns = meths.create_namespace('ns')
+ meths.buf_set_extmark(0, ns, 0, 0, { virt_lines_above = true, virt_lines = {{{"virt_line above line 1", ""}}} })
+ meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"virt_line below line 2", ""}}} })
+ meths.buf_set_extmark(0, ns, 2, 0, { virt_lines_above = true, virt_lines = {{{"virt_line above line 3", ""}}} })
+ meths.buf_set_extmark(0, ns, 3, 0, { virt_lines = {{{"virt_line below line 4", ""}}} })
if multigrid then
- screen:expect([[
+ screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -1888,7 +2058,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
- ]])
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 5, curline = 0, curcol = 0, linecount = 4, sum_scroll_delta = 0};
+ }}
else
screen:expect([[
{5:^+-- 2 lines: line 1·························}|
@@ -1904,7 +2076,7 @@ describe("folded lines", function()
feed('jzfj')
if multigrid then
- screen:expect([[
+ screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -1924,7 +2096,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
- ]])
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 5, curline = 2, curcol = 0, linecount = 4, sum_scroll_delta = 0};
+ }}
else
screen:expect([[
{5:+-- 2 lines: line 1·························}|
@@ -1941,7 +2115,7 @@ describe("folded lines", function()
feed('kzo<C-Y>')
funcs.setline(5, 'line 5')
if multigrid then
- screen:expect([[
+ screen:expect{grid=[[
## grid 1
[2:---------------------------------------------]|
[2:---------------------------------------------]|
@@ -1961,7 +2135,9 @@ describe("folded lines", function()
{1:~ }|
## grid 3
|
- ]])
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = -1};
+ }}
else
screen:expect([[
virt_line above line 1 |
@@ -1974,6 +2150,940 @@ describe("folded lines", function()
|
]])
end
+
+ meths.input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0)
+ eq({
+ screencol = 1,
+ screenrow = 5,
+ winid = 1000,
+ wincol = 1,
+ winrow = 5,
+ line = 3,
+ column = 1,
+ coladd = 0,
+ }, funcs.getmousepos())
+
+ meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"more virt_line below line 2", ""}}} })
+ feed('G<C-E>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ line 1 |
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect([[
+ line 1 |
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ |
+ ]])
+ end
+
+ feed('<C-E>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 1, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 1};
+ }}
+ else
+ screen:expect([[
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+
+ feed('<C-E>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2};
+ }}
+ else
+ screen:expect([[
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+
+ feed('<C-E>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 3};
+ }}
+ else
+ screen:expect([[
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+
+ feed('<C-E>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 4};
+ }}
+ else
+ screen:expect([[
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+
+ feed('<C-E>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 4, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 5};
+ }}
+ else
+ screen:expect([[
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+
+ feed('3<C-Y>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2};
+ }}
+ else
+ screen:expect([[
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^line 5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+
+ meths.input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^l{16:ine 5} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL LINE --} |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2};
+ }}
+ else
+ screen:expect([[
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^l{16:ine 5} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL LINE --} |
+ ]])
+ end
+
+ meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^l{16:ine 5} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL LINE --} |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 3};
+ }}
+ else
+ screen:expect([[
+ more virt_line below line 2 |
+ {5:+-- 2 lines: line 3·························}|
+ ^l{16:ine 5} |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL LINE --} |
+ ]])
+ end
+
+ meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5)
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {5:+-- 2 lines: line 3·························}|
+ {16:line }^5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL LINE --} |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 5, linecount = 5, sum_scroll_delta = 4};
+ }}
+ else
+ screen:expect([[
+ {5:+-- 2 lines: line 3·························}|
+ {16:line }^5 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL LINE --} |
+ ]])
+ end
+
+ feed('<Esc>gg')
+ command('botright 1split | wincmd w')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ {3:[No Name] [+] }|
+ [4:---------------------------------------------]|
+ {2:[No Name] [+] }|
+ [3:---------------------------------------------]|
+ ## grid 2
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ ## grid 3
+ |
+ ## grid 4
+ line 1 |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = 0};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect([[
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ more virt_line below line 2 |
+ {3:[No Name] [+] }|
+ line 1 |
+ {2:[No Name] [+] }|
+ |
+ ]])
+ end
+
+ feed('<C-Y>')
+ if multigrid then
+ screen:expect{grid=[[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ {3:[No Name] [+] }|
+ [4:---------------------------------------------]|
+ {2:[No Name] [+] }|
+ [3:---------------------------------------------]|
+ ## grid 2
+ virt_line above line 1 |
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ ## grid 3
+ |
+ ## grid 4
+ line 1 |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = -1};
+ [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 5, sum_scroll_delta = 0};
+ }}
+ else
+ screen:expect([[
+ virt_line above line 1 |
+ ^line 1 |
+ line 2 |
+ virt_line below line 2 |
+ {3:[No Name] [+] }|
+ line 1 |
+ {2:[No Name] [+] }|
+ |
+ ]])
+ end
+ end)
+
+ it('Folded and Visual highlights are combined #19691', function()
+ command('hi! Visual guibg=Red')
+ insert([[
+ " foofoofoofoofoofoo
+ " 口 {{{1
+ set nocp
+ " }}}1
+ " barbarbarbarbarbar
+ " 口 {{{1
+ set foldmethod=marker
+ " }}}1
+ " bazbazbazbazbazbaz]])
+ feed('gg')
+ command('source')
+ feed('<C-V>G15l')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {14:" foofoofoofoofo}ofoo |
+ {15:+-- 3 lines: " }{5:口···························}|
+ {14:" barbarbarbarba}rbar |
+ {15:+-- 3 lines: " }{5:口···························}|
+ {14:" bazbazbazbazb}^azbaz |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ else
+ screen:expect([[
+ {14:" foofoofoofoofo}ofoo |
+ {15:+-- 3 lines: " }{5:口···························}|
+ {14:" barbarbarbarba}rbar |
+ {15:+-- 3 lines: " }{5:口···························}|
+ {14:" bazbazbazbazb}^azbaz |
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ end
+
+ feed('l')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {14:" foofoofoofoofoo}foo |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" barbarbarbarbar}bar |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" bazbazbazbazba}^zbaz |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ else
+ screen:expect([[
+ {14:" foofoofoofoofoo}foo |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" barbarbarbarbar}bar |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" bazbazbazbazba}^zbaz |
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ end
+
+ feed('l')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {14:" foofoofoofoofoof}oo |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" barbarbarbarbarb}ar |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" bazbazbazbazbaz}^baz |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ else
+ screen:expect([[
+ {14:" foofoofoofoofoof}oo |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" barbarbarbarbarb}ar |
+ {15:+-- 3 lines: " 口}{5:···························}|
+ {14:" bazbazbazbazbaz}^baz |
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ end
+
+ feed('2l')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {14:" foofoofoofoofoofoo} |
+ {15:+-- 3 lines: " 口··}{5:·························}|
+ {14:" barbarbarbarbarbar} |
+ {15:+-- 3 lines: " 口··}{5:·························}|
+ {14:" bazbazbazbazbazba}^z |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ else
+ screen:expect([[
+ {14:" foofoofoofoofoofoo} |
+ {15:+-- 3 lines: " 口··}{5:·························}|
+ {14:" barbarbarbarbarbar} |
+ {15:+-- 3 lines: " 口··}{5:·························}|
+ {14:" bazbazbazbazbazba}^z |
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ end
+
+ feed('O16l')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ " foofoofoofoofo{14:ofoo} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " barbarbarbarba{14:rbar} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " bazbazbazbazba^z{14:baz} |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ else
+ screen:expect([[
+ " foofoofoofoofo{14:ofoo} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " barbarbarbarba{14:rbar} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " bazbazbazbazba^z{14:baz} |
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ end
+
+ feed('l')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ " foofoofoofoofoo{14:foo} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " barbarbarbarbar{14:bar} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " bazbazbazbazbaz^b{14:az} |
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ else
+ screen:expect([[
+ " foofoofoofoofoo{14:foo} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " barbarbarbarbar{14:bar} |
+ {5:+-- 3 lines: " }{15:口··}{5:·························}|
+ " bazbazbazbazbaz^b{14:az} |
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL BLOCK --} |
+ ]])
+ end
+ end)
+
+ it('do not show search or match highlight #24084', function()
+ insert([[
+ line 1
+ line 2
+ line 3
+ line 4]])
+ command('2,3fold')
+ feed('/line')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {2:line} 1 |
+ {5:+-- 2 lines: line 2·························}|
+ {6:line} 4 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ /line^ |
+ ]])
+ else
+ screen:expect([[
+ {2:line} 1 |
+ {5:+-- 2 lines: line 2·························}|
+ {6:line} 4 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ /line^ |
+ ]])
+ end
+ feed('<Esc>')
+ funcs.matchadd('Search', 'line')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [2:---------------------------------------------]|
+ [3:---------------------------------------------]|
+ ## grid 2
+ {6:line} 1 |
+ {5:+-- 2 lines: line 2·························}|
+ {6:line} ^4 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]])
+ else
+ screen:expect([[
+ {6:line} 1 |
+ {5:+-- 2 lines: line 2·························}|
+ {6:line} ^4 |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+ end)
+
+ it('support foldtext with virtual text format', function()
+ screen:try_resize(30, 7)
+ insert(content1)
+ command("hi! CursorLine guibg=NONE guifg=Red gui=NONE")
+ command('hi F0 guibg=Red guifg=Black')
+ command('hi F1 guifg=White')
+ meths.set_option_value('cursorline', true, {})
+ meths.set_option_value('foldcolumn', '4', {})
+ meths.set_option_value('foldtext', '['
+ .. '["▶", ["F0", "F1"]], '
+ .. '[v:folddashes], '
+ .. '["\t", "Search"], '
+ .. '[getline(v:foldstart), "NonText"]]', {})
+
+ command('3,4fold')
+ command('5,6fold')
+ command('2,6fold')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [3:------------------------------]|
+ ## grid 2
+ {7: }This is a |
+ {7:+ }{4:^▶}{13:-}{17: }{18:valid English}{13:·····}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]])
+ else
+ screen:expect([[
+ {7: }This is a |
+ {7:+ }{4:^▶}{13:-}{17: }{18:valid English}{13:·····}|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+ eq('▶-\tvalid English', funcs.foldtextresult(2))
+
+ feed('zo')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [3:------------------------------]|
+ ## grid 2
+ {7: }This is a |
+ {7:- }valid English |
+ {7:│+ }{4:▶}{5:--}{19: }{18:sentence composed }|
+ {7:│+ }{4:^▶}{13:--}{17: }{18:in his cave.}{13:······}|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ]])
+ else
+ screen:expect([[
+ {7: }This is a |
+ {7:- }valid English |
+ {7:│+ }{4:▶}{5:--}{19: }{18:sentence composed }|
+ {7:│+ }{4:^▶}{13:--}{17: }{18:in his cave.}{13:······}|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end
+ eq('▶--\tsentence composed by', funcs.foldtextresult(3))
+ eq('▶--\tin his cave.', funcs.foldtextresult(5))
+
+ command('hi! Visual guibg=Red')
+ feed('V2k')
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [3:------------------------------]|
+ ## grid 2
+ {7: }This is a |
+ {7:- }^v{14:alid English} |
+ {7:│+ }{4:▶}{15:--}{19: }{20:sentence composed }|
+ {7:│+ }{4:▶}{15:--}{19: }{20:in his cave.}{15:······}|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ {11:-- VISUAL LINE --} |
+ ]])
+ else
+ screen:expect([[
+ {7: }This is a |
+ {7:- }^v{14:alid English} |
+ {7:│+ }{4:▶}{15:--}{19: }{20:sentence composed }|
+ {7:│+ }{4:▶}{15:--}{19: }{20:in his cave.}{15:······}|
+ {1:~ }|
+ {1:~ }|
+ {11:-- VISUAL LINE --} |
+ ]])
+ end
+
+ meths.set_option_value('rightleft', true, {})
+ if multigrid then
+ screen:expect([[
+ ## grid 1
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [2:------------------------------]|
+ [3:------------------------------]|
+ ## grid 2
+ a si sihT{7: }|
+ {14:hsilgnE dila}^v{7: -}|
+ {20: desopmoc ecnetnes}{19: }{15:--}{4:▶}{7: +│}|
+ {15:······}{20:.evac sih ni}{19: }{15:--}{4:▶}{7: +│}|
+ {1: ~}|
+ {1: ~}|
+ ## grid 3
+ {11:-- VISUAL LINE --} |
+ ]])
+ else
+ screen:expect([[
+ a si sihT{7: }|
+ {14:hsilgnE dila}^v{7: -}|
+ {20: desopmoc ecnetnes}{19: }{15:--}{4:▶}{7: +│}|
+ {15:······}{20:.evac sih ni}{19: }{15:--}{4:▶}{7: +│}|
+ {1: ~}|
+ {1: ~}|
+ {11:-- VISUAL LINE --} |
+ ]])
+ end
end)
end
@@ -1984,26 +3094,4 @@ describe("folded lines", function()
describe('without ext_multigrid', function()
with_ext_multigrid(false)
end)
-
- it('no folds remains if :delete makes buffer empty #19671', function()
- funcs.setline(1, {'foo', 'bar', 'baz'})
- command('2,3fold')
- command('%delete')
- eq(0, funcs.foldlevel(1))
- end)
-
- it('multibyte fold markers work #20438', function()
- meths.win_set_option(0, 'foldmethod', 'marker')
- meths.win_set_option(0, 'foldmarker', '«,»')
- insert([[
- bbbbb
- bbbbb
- bbbbb]])
- feed('zfgg')
- expect([[
- bbbbb/*«*/
- bbbbb
- bbbbb/*»*/]])
- eq(1, funcs.foldlevel(1))
- end)
end)