diff options
Diffstat (limited to 'test/functional/ui/fold_spec.lua')
-rw-r--r-- | test/functional/ui/fold_spec.lua | 586 |
1 files changed, 405 insertions, 181 deletions
diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 55197c75a8..6951d2eb9a 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -9,7 +9,6 @@ local meths = helpers.meths local exec = helpers.exec local assert_alive = helpers.assert_alive - local content1 = [[ This is a valid English @@ -18,7 +17,7 @@ local content1 = [[ in his cave. ]] -describe("folded lines", function() +describe('folded lines', function() before_each(function() clear() command('hi VertSplit gui=reverse') @@ -28,35 +27,39 @@ describe("folded lines", function() local screen before_each(function() screen = Screen.new(45, 8) - screen:attach({rgb=true, ext_multigrid=multigrid}) + 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.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] = {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}, + [1] = { bold = true, foreground = Screen.colors.Blue1 }, + [2] = { reverse = true }, + [3] = { bold = true, reverse = true }, + [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] = { 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) - it("work with more than one signcolumn", function() - command("set signcolumn=yes:9") - feed("i<cr><esc>") - feed("vkzf") + it('work with more than one signcolumn', function() + command('set signcolumn=yes:9') + feed('i<cr><esc>') + feed('vkzf') if multigrid then screen:expect([[ ## grid 1 @@ -78,10 +81,10 @@ describe("folded lines", function() end) local function test_folded_cursorline() - command("set number cursorline foldcolumn=2") - command("hi link CursorLineFold Search") + command('set number cursorline foldcolumn=2') + command('hi link CursorLineFold Search') insert(content1) - feed("ggzf3jj") + feed('ggzf3jj') if multigrid then screen:expect([[ ## grid 1 @@ -104,7 +107,7 @@ describe("folded lines", function() | ]]) end - feed("k") + feed('k') if multigrid then screen:expect([[ ## grid 1 @@ -128,12 +131,12 @@ describe("folded lines", function() ]]) end -- CursorLine is applied correctly with screenrow motions #22232 - feed("jgk") + feed('jgk') screen:expect_unchanged() -- CursorLine is applied correctly when closing a fold when cursor is not at fold start - feed("zo4Gzc") + feed('zo4Gzc') screen:expect_unchanged() - command("set cursorlineopt=line") + command('set cursorlineopt=line') if multigrid then screen:expect([[ ## grid 1 @@ -156,7 +159,7 @@ describe("folded lines", function() | ]]) end - command("set relativenumber cursorlineopt=number") + command('set relativenumber cursorlineopt=number') if multigrid then screen:expect([[ ## grid 1 @@ -183,55 +186,63 @@ describe("folded lines", function() describe("when 'cursorline' is set", function() it('with high-priority CursorLine', function() - command("hi! CursorLine guibg=NONE guifg=Red gui=NONE") + 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") + 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} + 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() - command("set spell") + it('work with spell', function() + command('set spell') insert(content1) - feed("gg") - feed("zf3j") + feed('gg') + feed('zf3j') if not multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ {5:^+-- 4 lines: This is a······················}| in his cave. | | {1:~ }|*4 | - ]]} + ]], + } end end) - it("work with matches", function() + it('work with matches', function() insert(content1) - command("highlight MyWord gui=bold guibg=red guifg=white") + command('highlight MyWord gui=bold guibg=red guifg=white') command("call matchadd('MyWord', '\\V' . 'test', -1)") - feed("gg") - feed("zf3j") + feed('gg') + feed('zf3j') if not multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ {5:^+-- 4 lines: This is a······················}| in his cave. | | {1:~ }|*4 | - ]]} + ]], + } end end) - it("works with multibyte fillchars", function() + it('works with multibyte fillchars', function() insert([[ aa bb @@ -239,9 +250,9 @@ describe("folded lines", function() dd ee ff]]) - command("set fillchars+=foldopen:▾,foldsep:│,foldclose:▸") + command('set fillchars+=foldopen:▾,foldsep:│,foldclose:▸') feed_command('1') - command("set foldcolumn=2") + command('set foldcolumn=2') feed('zf4j') feed('zf2j') feed('zO') @@ -274,7 +285,7 @@ describe("folded lines", function() ]]) end - feed_command("set rightleft") + feed_command('set rightleft') if multigrid then screen:expect([[ ## grid 1 @@ -304,7 +315,7 @@ describe("folded lines", function() ]]) end - feed_command("set norightleft") + feed_command('set norightleft') if multigrid then meths.input_mouse('left', 'press', '', 2, 0, 1) screen:expect([[ @@ -408,7 +419,7 @@ describe("folded lines", function() end end) - it("works with split", function() + it('works with split', function() insert([[ aa bb @@ -417,12 +428,12 @@ describe("folded lines", function() ee ff]]) feed_command('2') - command("set foldcolumn=1") + command('set foldcolumn=1') feed('zf3j') feed_command('1') feed('zf2j') feed('zO') - feed_command("rightbelow new") + feed_command('rightbelow new') insert([[ aa bb @@ -431,7 +442,7 @@ describe("folded lines", function() ee ff]]) feed_command('2') - command("set foldcolumn=1") + command('set foldcolumn=1') feed('zf3j') feed_command('1') feed('zf2j') @@ -568,7 +579,7 @@ describe("folded lines", function() end end) - it("works with vsplit", function() + it('works with vsplit', function() insert([[ aa bb @@ -577,12 +588,12 @@ describe("folded lines", function() ee ff]]) feed_command('2') - command("set foldcolumn=1") + command('set foldcolumn=1') feed('zf3j') feed_command('1') feed('zf2j') feed('zO') - feed_command("rightbelow vnew") + feed_command('rightbelow vnew') insert([[ aa bb @@ -591,7 +602,7 @@ describe("folded lines", function() ee ff]]) feed_command('2') - command("set foldcolumn=1") + command('set foldcolumn=1') feed('zf3j') feed_command('1') feed('zf2j') @@ -740,7 +751,7 @@ describe("folded lines", function() end end) - it("works with tab", function() + it('works with tab', function() insert([[ aa bb @@ -749,12 +760,12 @@ describe("folded lines", function() ee ff]]) feed_command('2') - command("set foldcolumn=2") + command('set foldcolumn=2') feed('zf3j') feed_command('1') feed('zf2j') feed('zO') - feed_command("tab split") + feed_command('tab split') if multigrid then meths.input_mouse('left', 'press', '', 4, 1, 1) screen:expect([[ @@ -821,7 +832,7 @@ describe("folded lines", function() ]]) end - feed_command("tabnext") + feed_command('tabnext') if multigrid then meths.input_mouse('left', 'press', '', 2, 1, 1) screen:expect([[ @@ -879,7 +890,7 @@ describe("folded lines", function() end end) - it("works with multibyte text", function() + it('works with multibyte text', function() eq(true, meths.get_option_value('arabicshape', {})) insert([[ å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢͟ العَرَبِيَّة @@ -925,7 +936,7 @@ describe("folded lines", function() ]]) end - feed_command("set noarabicshape") + feed_command('set noarabicshape') if multigrid then screen:expect([[ ## grid 1 @@ -945,7 +956,7 @@ describe("folded lines", function() ]]) end - feed_command("set number foldcolumn=2") + feed_command('set number foldcolumn=2') if multigrid then screen:expect([[ ## grid 1 @@ -966,7 +977,7 @@ describe("folded lines", function() end -- Note: too much of the folded line gets cut off.This is a vim bug. - feed_command("set rightleft") + feed_command('set rightleft') if multigrid then screen:expect([[ ## grid 1 @@ -986,7 +997,7 @@ describe("folded lines", function() ]]) end - feed_command("set nonumber foldcolumn=0") + feed_command('set nonumber foldcolumn=0') if multigrid then screen:expect([[ ## grid 1 @@ -1006,7 +1017,7 @@ describe("folded lines", function() ]]) end - feed_command("set arabicshape") + feed_command('set arabicshape') if multigrid then screen:expect([[ ## grid 1 @@ -1069,16 +1080,15 @@ describe("folded lines", function() :set noarabicshape | ]]) end - end) - it("work in cmdline window", function() - feed_command("set foldmethod=manual") - feed_command("let x = 1") - feed_command("/alpha") - feed_command("/omega") + it('work in cmdline window', function() + feed_command('set foldmethod=manual') + feed_command('let x = 1') + feed_command('/alpha') + feed_command('/omega') - feed("<cr>q:") + feed('<cr>q:') if multigrid then screen:expect([[ ## grid 1 @@ -1110,7 +1120,7 @@ describe("folded lines", function() ]]) end - feed("kzfk") + feed('kzfk') if multigrid then screen:expect([[ ## grid 1 @@ -1140,7 +1150,7 @@ describe("folded lines", function() ]]) end - feed("<cr>") + feed('<cr>') if multigrid then screen:expect([[ ## grid 1 @@ -1160,7 +1170,7 @@ describe("folded lines", function() ]]) end - feed("/<c-f>") + feed('/<c-f>') if multigrid then screen:expect([[ ## grid 1 @@ -1192,7 +1202,7 @@ describe("folded lines", function() ]]) end - feed("ggzfG") + feed('ggzfG') if multigrid then screen:expect([[ ## grid 1 @@ -1219,18 +1229,16 @@ describe("folded lines", function() / | ]]) end - end) - it("work with autoresize", function() - + it('work with autoresize', function() funcs.setline(1, 'line 1') funcs.setline(2, 'line 2') funcs.setline(3, 'line 3') funcs.setline(4, 'line 4') - feed("zfj") - command("set foldcolumn=0") + feed('zfj') + command('set foldcolumn=0') if multigrid then screen:expect([[ ## grid 1 @@ -1254,7 +1262,7 @@ describe("folded lines", function() ]]) end -- should adapt to the current nesting of folds (e.g., 1) - command("set foldcolumn=auto:1") + command('set foldcolumn=auto:1') if multigrid then screen:expect([[ ## grid 1 @@ -1277,9 +1285,10 @@ describe("folded lines", function() | ]]) end - command("set foldcolumn=auto") + command('set foldcolumn=auto') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1290,18 +1299,23 @@ describe("folded lines", function() {1:~ }|*4 ## grid 3 | - ]], unchanged=true} + ]], + unchanged = true, + } else - screen:expect{grid=[[ + screen:expect { + grid = [[ {7:+}{5:^+-- 2 lines: line 1························}| {7: }line 3 | {7: }line 4 | {1:~ }|*4 | - ]], unchanged=true} + ]], + unchanged = true, + } end -- fdc should not change with a new fold as the maximum is 1 - feed("zf3j") + feed('zf3j') if multigrid then screen:expect([[ @@ -1322,8 +1336,10 @@ describe("folded lines", function() ]]) end - command("set foldcolumn=auto:1") - if multigrid then screen:expect{grid=[[ + command('set foldcolumn=auto:1') + if multigrid then + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1332,18 +1348,23 @@ describe("folded lines", function() {1:~ }|*6 ## grid 3 | - ]], unchanged=true} + ]], + unchanged = true, + } else - screen:expect{grid=[[ + screen:expect { + grid = [[ {7:+}{5:^+-- 4 lines: line 1························}| {1:~ }|*6 | - ]], unchanged=true} + ]], + unchanged = true, + } end -- relax the maximum fdc thus fdc should expand to -- accommodate the current number of folds - command("set foldcolumn=auto:4") + command('set foldcolumn=auto:4') if multigrid then screen:expect([[ ## grid 1 @@ -1371,8 +1392,8 @@ describe("folded lines", function() endfunction ]]) command('set foldtext=MyFoldText()') - feed("i<cr><esc>") - feed("vkzf") + feed('i<cr><esc>') + feed('vkzf') if multigrid then screen:expect([[ ## grid 1 @@ -1509,14 +1530,27 @@ describe("folded lines", function() funcs.setline(2, 'line 2') funcs.setline(3, 'line 3') funcs.setline(4, 'line 4') - feed("zfj") + feed('zfj') 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{grid=[[ + 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 { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1529,9 +1563,19 @@ describe("folded lines", function() {1:~ }|*2 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 5, curline = 0, curcol = 0, linecount = 4, sum_scroll_delta = 0}; - }} + ]], + 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·························}| @@ -1546,7 +1590,8 @@ describe("folded lines", function() feed('jzfj') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1556,9 +1601,19 @@ describe("folded lines", function() {1:~ }|*5 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 5, curline = 2, curcol = 0, linecount = 4, sum_scroll_delta = 0}; - }} + ]], + 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·························}| @@ -1571,7 +1626,8 @@ describe("folded lines", function() feed('kzo<C-Y>') funcs.setline(5, 'line 5') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1585,9 +1641,19 @@ 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}; - }} + ]], + 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 | @@ -1613,10 +1679,17 @@ describe("folded lines", function() coladd = 0, }, funcs.getmousepos()) - meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"more virt_line below line 2", ""}}} }) + 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=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1630,9 +1703,19 @@ describe("folded lines", function() {1:~ }| ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 0, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 0}; - }} + ]], + 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 | @@ -1648,7 +1731,8 @@ describe("folded lines", function() feed('<C-E>') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1661,9 +1745,19 @@ describe("folded lines", function() {1:~ }|*2 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 1, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 1}; - }} + ]], + 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 | @@ -1678,7 +1772,8 @@ describe("folded lines", function() feed('<C-E>') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1690,9 +1785,19 @@ describe("folded lines", function() {1:~ }|*3 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2}; - }} + ]], + 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 | @@ -1706,7 +1811,8 @@ describe("folded lines", function() feed('<C-E>') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1717,9 +1823,19 @@ describe("folded lines", function() {1:~ }|*4 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 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 | @@ -1732,7 +1848,8 @@ describe("folded lines", function() feed('<C-E>') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1742,9 +1859,19 @@ describe("folded lines", function() {1:~ }|*5 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 4}; - }} + ]], + 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·························}| @@ -1756,7 +1883,8 @@ describe("folded lines", function() feed('<C-E>') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1765,9 +1893,19 @@ describe("folded lines", function() {1:~ }|*6 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 4, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 5}; - }} + ]], + 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 | @@ -1778,7 +1916,8 @@ describe("folded lines", function() feed('3<C-Y>') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1790,9 +1929,19 @@ describe("folded lines", function() {1:~ }|*3 ## grid 3 | - ]], win_viewport={ - [2] = {win = {id = 1000}, topline = 2, botline = 6, curline = 4, curcol = 0, linecount = 5, sum_scroll_delta = 2}; - }} + ]], + 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 | @@ -1806,7 +1955,8 @@ describe("folded lines", function() meths.input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0) if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1818,9 +1968,19 @@ describe("folded lines", function() {1:~ }|*3 ## 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}; - }} + ]], + 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 | @@ -1834,7 +1994,8 @@ describe("folded lines", function() meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0) if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1845,9 +2006,19 @@ describe("folded lines", function() {1:~ }|*4 ## 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}; - }} + ]], + 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 | @@ -1860,7 +2031,8 @@ describe("folded lines", function() meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5) if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*7 [3:---------------------------------------------]| @@ -1870,9 +2042,19 @@ describe("folded lines", function() {1:~ }|*5 ## 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}; - }} + ]], + 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·························}| @@ -1885,7 +2067,8 @@ describe("folded lines", function() feed('<Esc>gg') command('botright 1split | wincmd w') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*4 {3:[No Name] [+] }| @@ -1901,10 +2084,28 @@ describe("folded lines", function() | ## 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}; - }} + ]], + 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 | @@ -1920,7 +2121,8 @@ describe("folded lines", function() feed('<C-Y>') if multigrid then - screen:expect{grid=[[ + screen:expect { + grid = [[ ## grid 1 [2:---------------------------------------------]|*4 {3:[No Name] [+] }| @@ -1936,10 +2138,28 @@ describe("folded lines", function() | ## 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}; - }} + ]], + 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 | @@ -2196,16 +2416,20 @@ describe("folded lines", function() 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! 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"]]', {}) + meths.set_option_value( + 'foldtext', + '[' + .. '["▶", ["F0", "F1"]], ' + .. '[v:folddashes], ' + .. '["\t", "Search"], ' + .. '[getline(v:foldstart), "NonText"]]', + {} + ) command('3,4fold') command('5,6fold') @@ -2315,7 +2539,7 @@ describe("folded lines", function() end) end - describe("with ext_multigrid", function() + describe('with ext_multigrid', function() with_ext_multigrid(true) end) |