From 53968082675cd3b8d1809e53a47c0311b7347ef9 Mon Sep 17 00:00:00 2001 From: luukvbaal <31730729+luukvbaal@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:52:22 +0100 Subject: fix(folds): cursorline highlight is not always applied on closed folds (#22242) Problem: The cursorline highlight logic checks for `w_cursor.lnum` which may be different from the line number passed to `win_line()` even when the cursor is actually on that line. Solution: Update cursor line highlight logic to check for the line number of the start of a closed fold if necessary. --- test/functional/ui/fold_spec.lua | 132 ++++++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 44 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 46a478c1ea..420a4654f8 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -10,6 +10,7 @@ local meths = helpers.meths local exec = helpers.exec local exec_lua = helpers.exec_lua local assert_alive = helpers.assert_alive +local poke_eventloop = helpers.poke_eventloop local content1 = [[ @@ -90,10 +91,10 @@ describe("folded lines", function() end) it("highlights with CursorLineFold when 'cursorline' is set", function() - command("set cursorline foldcolumn=2 foldmethod=marker") + 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 +107,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 +142,36 @@ 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 }{12:^+-- 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 }{12:^+-- 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") + poke_eventloop() + screen:expect_unchanged() + -- CursorLine is applied correctly when closing a fold when cursor is not at fold start + feed("zo4Gzc") + poke_eventloop() + screen:expect_unchanged() command("set cursorlineopt=line") if multigrid then screen:expect([[ @@ -176,26 +185,61 @@ 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 }{12:^+-- 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 }{12:^+-- 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) -- cgit From 05faa8f30ad770d4e4ead41cec601ccced8fb97f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 15 Feb 2023 07:26:55 +0800 Subject: test: make expect_unchanged() less confusing (#22255) Problem: The sleep before collecting the initial screen state is confusing and may lead to unexpected success if it comes after a blocking RPC call. Solution: Remove that sleep and add an "intermediate" argument. --- test/functional/ui/fold_spec.lua | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 420a4654f8..c8a3397a86 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -10,7 +10,6 @@ local meths = helpers.meths local exec = helpers.exec local exec_lua = helpers.exec_lua local assert_alive = helpers.assert_alive -local poke_eventloop = helpers.poke_eventloop local content1 = [[ @@ -30,8 +29,6 @@ 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({ @@ -166,12 +163,10 @@ describe("folded lines", function() end -- CursorLine is applied correctly with screenrow motions #22232 feed("jgk") - poke_eventloop() - screen:expect_unchanged() + screen:expect_unchanged(true) -- CursorLine is applied correctly when closing a fold when cursor is not at fold start feed("zo4Gzc") - poke_eventloop() - screen:expect_unchanged() + screen:expect_unchanged(true) command("set cursorlineopt=line") if multigrid then screen:expect([[ -- cgit From 269dd747b6e61842856031ca14ac26ee884ede4c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 2 Apr 2023 23:01:48 +0800 Subject: refactor(defaults)!: change default 'commentstring' value to empty (#22862) --- test/functional/ui/fold_spec.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index c8a3397a86..96e28c1978 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -2032,8 +2032,11 @@ describe("folded lines", function() end) it('multibyte fold markers work #20438', function() - meths.win_set_option(0, 'foldmethod', 'marker') - meths.win_set_option(0, 'foldmarker', '«,»') + exec([[ + setlocal foldmethod=marker + setlocal foldmarker=«,» + setlocal commentstring=/*%s*/ + ]]) insert([[ bbbbb bbbbb -- cgit From 73060f00dd84b2fcfaed74ba061644975707c225 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 7 Apr 2023 09:29:12 +0800 Subject: test: improve editor/fold_spec.lua and editor/put_spec.lua (#22916) - Close and open a new window each time so that window options have their default values in each test. - Change feed_command() to command() as the latter is faster. --- test/functional/ui/fold_spec.lua | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 96e28c1978..a99b77f707 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -4,7 +4,6 @@ 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 @@ -2023,29 +2022,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() - exec([[ - setlocal foldmethod=marker - setlocal foldmarker=«,» - setlocal commentstring=/*%s*/ - ]]) - insert([[ - bbbbb - bbbbb - bbbbb]]) - feed('zfgg') - expect([[ - bbbbb/*«*/ - bbbbb - bbbbb/*»*/]]) - eq(1, funcs.foldlevel(1)) - end) end) -- cgit From 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 19 Dec 2022 16:37:45 +0000 Subject: refactor(options): deprecate nvim[_buf|_win]_[gs]et_option Co-authored-by: zeertzjq Co-authored-by: famiu --- test/functional/ui/fold_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index a99b77f707..7a0495f93c 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -967,8 +967,8 @@ describe("folded lines", function() 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(6, meths.get_option_value('maxcombine', {})) + eq(true, meths.get_option_value('arabicshape', {})) insert([[ å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢͟ العَرَبِيَّة möre text]]) -- cgit From 678548a2b44601db73cc7d049467abd2b433baae Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 24 May 2023 21:25:39 +0800 Subject: fix(folds): show Folded highlight in Visual selection (#23741) Note: CursorLine highlight is now combined with Folded. --- test/functional/ui/fold_spec.lua | 65 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 7a0495f93c..2afe27ecc7 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -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('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() -- cgit From ee986ee0449b828ca64bf7d4c69624596aab8319 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 25 May 2023 22:14:12 +0800 Subject: fix(folds): combined Folded and Visual highlights (#23752) Also combine high-priority CursorLine with Folded. --- test/functional/ui/fold_spec.lua | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 2afe27ecc7..520979a2c2 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -42,9 +42,10 @@ 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, underline = true}, - [13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey, underline = true}, - [14] = {background = Screen.colors.LightGray}, + [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}, }) end) @@ -88,10 +89,9 @@ describe("folded lines", function() end end) - it("foldcolumn highlighted with CursorLineFold when 'cursorline' is set", function() + local function test_folded_cursorline() 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 @@ -239,6 +239,22 @@ describe("folded lines", function() | ]]) 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() @@ -2017,7 +2033,8 @@ describe("folded lines", function() end end) - it('Folded highlight does not disappear in Visual selection #19691', function() + it('Folded and Visual highlights are combined #19691', function() + command('hi! Visual guibg=Red') insert([[ " foo " {{{1 @@ -2044,9 +2061,9 @@ describe("folded lines", function() [3:---------------------------------------------]| ## grid 2 {14:" fo}o | - {5:+-- 3 lines: "······························}| + {15:+-- }{5: 3 lines: "······························}| {14:" ba}r | - {5:+-- 3 lines: "······························}| + {15:+-- }{5: 3 lines: "······························}| {14:" b}^az | {1:~ }| {1:~ }| @@ -2056,9 +2073,9 @@ describe("folded lines", function() else screen:expect([[ {14:" fo}o | - {5:+-- 3 lines: "······························}| + {15:+-- }{5: 3 lines: "······························}| {14:" ba}r | - {5:+-- 3 lines: "······························}| + {15:+-- }{5: 3 lines: "······························}| {14:" b}^az | {1:~ }| {1:~ }| -- cgit From 7955c90621bb679f9c16b6788fbcb6145739886f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 5 Jun 2023 06:58:44 +0800 Subject: fix(plines): folded lines with virt_lines attached to line above --- test/functional/ui/fold_spec.lua | 232 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 223 insertions(+), 9 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 520979a2c2..06668c0ba3 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -7,7 +7,6 @@ local insert = helpers.insert local funcs = helpers.funcs local meths = helpers.meths local exec = helpers.exec -local exec_lua = helpers.exec_lua local assert_alive = helpers.assert_alive @@ -1911,19 +1910,17 @@ 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([[ ## grid 1 @@ -2031,6 +2028,223 @@ describe("folded lines", function() | ]]) end + + meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"more virt_line below line 2", ""}}} }) + feed('G') + if multigrid then + screen:expect([[ + ## 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 + | + ]]) + 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('') + if multigrid then + screen:expect([[ + ## 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 + | + ]]) + 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('') + if multigrid then + screen:expect([[ + ## 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 + | + ]]) + 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('') + if multigrid then + screen:expect([[ + ## 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 + | + ]]) + else + screen:expect([[ + more virt_line below line 2 | + {5:+-- 2 lines: line 3·························}| + ^line 5 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) + end + + feed('') + if multigrid then + screen:expect([[ + ## 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 + | + ]]) + else + screen:expect([[ + {5:+-- 2 lines: line 3·························}| + ^line 5 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) + end + + feed('') + if multigrid then + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + ^line 5 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ]]) + else + screen:expect([[ + ^line 5 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) + end end) it('Folded and Visual highlights are combined #19691', function() -- cgit From a3fba5cafcf124946ea65a68fc1b9dfbeb197525 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 5 Jun 2023 17:11:58 +0800 Subject: fix(mouse): handle folded lines with virt_lines attached to line above (#23912) --- test/functional/ui/fold_spec.lua | 156 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 06668c0ba3..68a7c89b32 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -45,6 +45,7 @@ describe("folded lines", function() [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}, }) end) @@ -2029,6 +2030,17 @@ describe("folded lines", function() ]]) end + meths.input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0) + eq({ + column = 1, + line = 3, + screencol = 1, + screenrow = 5, + wincol = 1, + winid = 1000, + winrow = 5, + }, funcs.getmousepos()) + meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"more virt_line below line 2", ""}}} }) feed('G') if multigrid then @@ -2245,6 +2257,150 @@ describe("folded lines", function() | ]]) end + + feed('3') + if multigrid then + screen:expect([[ + ## 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 + | + ]]) + 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 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 --} | + ]]) + 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 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 --} | + ]]) + 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 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 --} | + ]]) + else + screen:expect([[ + {5:+-- 2 lines: line 3·························}| + {16:line }^5 | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {11:-- VISUAL LINE --} | + ]]) + end end) it('Folded and Visual highlights are combined #19691', function() -- cgit From ded01a819ab0e10104aa29ab67cf67e4efd75e04 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 21 Jun 2023 18:28:12 +0800 Subject: fix(folds): don't show search or match highlighting on fold (#24084) --- test/functional/ui/fold_spec.lua | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 68a7c89b32..71b9e49d2f 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -2453,6 +2453,86 @@ describe("folded lines", function() ]]) 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('') + 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) end describe("with ext_multigrid", function() -- cgit From e8b3ed74bca4bd6ececcc240f816451bef7fd58c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Jul 2023 14:14:09 +0800 Subject: fix(ui-ext): "scroll_delta" handle topfill and skipcol (#24249) --- test/functional/ui/fold_spec.lua | 78 ++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 26 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 71b9e49d2f..2c8455753e 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -1923,7 +1923,7 @@ describe("folded lines", function() 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:---------------------------------------------]| @@ -1943,7 +1943,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·························}| @@ -1959,7 +1961,7 @@ describe("folded lines", function() feed('jzfj') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -1979,7 +1981,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·························}| @@ -1996,7 +2000,7 @@ describe("folded lines", function() feed('kzo') funcs.setline(5, 'line 5') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2016,7 +2020,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 | @@ -2044,7 +2050,7 @@ describe("folded lines", function() meths.buf_set_extmark(0, ns, 1, 0, { virt_lines = {{{"more virt_line below line 2", ""}}} }) feed('G') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2064,7 +2070,9 @@ 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}; + }} else screen:expect([[ line 1 | @@ -2080,7 +2088,7 @@ describe("folded lines", function() feed('') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2100,7 +2108,9 @@ describe("folded lines", function() {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 | @@ -2116,7 +2126,7 @@ describe("folded lines", function() feed('') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2136,7 +2146,9 @@ describe("folded lines", function() {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 | @@ -2152,7 +2164,7 @@ describe("folded lines", function() feed('') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2172,7 +2184,9 @@ describe("folded lines", function() {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 | @@ -2188,7 +2202,7 @@ describe("folded lines", function() feed('') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2208,7 +2222,9 @@ describe("folded lines", function() {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·························}| @@ -2224,7 +2240,7 @@ describe("folded lines", function() feed('') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2244,7 +2260,9 @@ describe("folded lines", function() {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 | @@ -2260,7 +2278,7 @@ describe("folded lines", function() feed('3') if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2280,7 +2298,9 @@ describe("folded lines", function() {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 | @@ -2296,7 +2316,7 @@ describe("folded lines", function() meths.input_mouse('left', 'press', '3', multigrid and 2 or 0, 3, 0) if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2316,7 +2336,9 @@ describe("folded lines", function() {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 | @@ -2332,7 +2354,7 @@ describe("folded lines", function() meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 0) if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2352,7 +2374,9 @@ describe("folded lines", function() {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 | @@ -2368,7 +2392,7 @@ describe("folded lines", function() meths.input_mouse('left', 'drag', '3', multigrid and 2 or 0, 7, 5) if multigrid then - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [2:---------------------------------------------]| [2:---------------------------------------------]| @@ -2388,7 +2412,9 @@ describe("folded lines", function() {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·························}| -- cgit From 811140e276a6312775bfcf9b368de25386f7a356 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 7 Jul 2023 09:49:58 +0800 Subject: fix(folds): fix missing virt_lines above when fold is hidden (#24274) --- test/functional/ui/fold_spec.lua | 77 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 2c8455753e..d3119ccc42 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -2427,6 +2427,83 @@ describe("folded lines", function() {11:-- VISUAL LINE --} | ]]) end + + feed('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('') + 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() -- cgit From 06694203e51efbabc0b49e26704dff089011fd21 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 11 Jul 2023 13:16:31 +0800 Subject: fix(drawline): fix missing Visual hl on double-width fold char (#24308) --- test/functional/ui/fold_spec.lua | 212 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 196 insertions(+), 16 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index d3119ccc42..f00fba331e 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -2509,18 +2509,18 @@ describe("folded lines", function() it('Folded and Visual highlights are combined #19691', function() command('hi! Visual guibg=Red') insert([[ - " foo - " {{{1 + " foofoofoofoofoofoo + " 口 {{{1 set nocp " }}}1 - " bar - " {{{1 + " barbarbarbarbarbar + " 口 {{{1 set foldmethod=marker " }}}1 - " baz]]) + " bazbazbazbazbazbaz]]) feed('gg') command('source') - feed('G3l') + feed('G15l') if multigrid then screen:expect([[ ## grid 1 @@ -2533,11 +2533,11 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - {14:" fo}o | - {15:+-- }{5: 3 lines: "······························}| - {14:" ba}r | - {15:+-- }{5: 3 lines: "······························}| - {14:" b}^az | + {14:" foofoofoofoofo}ofoo | + {15:+-- 3 lines: " }{5:口···························}| + {14:" barbarbarbarba}rbar | + {15:+-- 3 lines: " }{5:口···························}| + {14:" bazbazbazbazb}^azbaz | {1:~ }| {1:~ }| ## grid 3 @@ -2545,11 +2545,191 @@ describe("folded lines", function() ]]) else screen:expect([[ - {14:" fo}o | - {15:+-- }{5: 3 lines: "······························}| - {14:" ba}r | - {15:+-- }{5: 3 lines: "······························}| - {14:" b}^az | + {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 --} | -- cgit From 71530cc972576e6656431b6d000aec9b69a0997e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 17 Sep 2023 20:29:18 +0800 Subject: feat(folds): support virtual text format for 'foldtext' (#25209) Co-authored-by: Lewis Russell --- test/functional/ui/fold_spec.lua | 121 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index f00fba331e..46de6b114e 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -40,12 +40,16 @@ describe("folded lines", function() [8] = {foreground = Screen.colors.Brown }, [9] = {bold = true, foreground = Screen.colors.Brown}, [10] = {background = Screen.colors.LightGrey, underline = true}, - [11] = {bold=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) @@ -2816,6 +2820,121 @@ describe("folded lines", function() ]]) 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") + meths.set_option_value('cursorline', true, {}) + meths.set_option_value('foldcolumn', '4', {}) + meths.set_option_value('foldtext', + '[[v:folddashes], ["\t", "Search"], [getline(v:foldstart), "NonText"]]', {}) + + command('3,4fold') + command('5,6fold') + command('2,6fold') + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [3:------------------------------]| + ## grid 2 + {7: }This is a | + {7:+ }{13:^-}{17: }{18:valid English}{13:·····}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ]]} + else + screen:expect([[ + {7: }This is a | + {7:+ }{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=[[ + ## grid 1 + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [3:------------------------------]| + ## grid 2 + {7: }This is a | + {7:- }valid English | + {7:│+ }{5:--}{19: }{18:sentence composed }| + {7:│+ }{13:^--}{17: }{18:in his cave.}{13:······}| + {1:~ }| + {1:~ }| + ## grid 3 + | + ]]} + else + screen:expect([[ + {7: }This is a | + {7:- }valid English | + {7:│+ }{5:--}{19: }{18:sentence composed }| + {7:│+ }{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=[[ + ## grid 1 + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [3:------------------------------]| + ## grid 2 + {7: }This is a | + {7:- }^v{14:alid English} | + {7:│+ }{15:--}{19: }{20:sentence composed }| + {7:│+ }{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:│+ }{15:--}{19: }{20:sentence composed }| + {7:│+ }{15:--}{19: }{20:in his cave.}{15:······}| + {1:~ }| + {1:~ }| + {11:-- VISUAL LINE --} | + ]]) + end + end) end describe("with ext_multigrid", function() -- cgit From f54677132b9052640ec0ecb79001a69a6d032565 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 17 Sep 2023 21:31:51 +0800 Subject: test(ui/fold_spec): click on multibyte "foldclosed" (#25216) --- test/functional/ui/fold_spec.lua | 51 +++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 46de6b114e..a371b45e2b 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -423,6 +423,45 @@ describe("folded lines", function() :set norightleft | ]]) end + + -- Add a winbar to avoid double-clicks + command('setlocal winbar=!!!!!!') + 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() @@ -2834,7 +2873,7 @@ describe("folded lines", function() command('5,6fold') command('2,6fold') if multigrid then - screen:expect{grid=[[ + screen:expect([[ ## grid 1 [2:------------------------------]| [2:------------------------------]| @@ -2852,7 +2891,7 @@ describe("folded lines", function() {1:~ }| ## grid 3 | - ]]} + ]]) else screen:expect([[ {7: }This is a | @@ -2868,7 +2907,7 @@ describe("folded lines", function() feed('zo') if multigrid then - screen:expect{grid=[[ + screen:expect([[ ## grid 1 [2:------------------------------]| [2:------------------------------]| @@ -2886,7 +2925,7 @@ describe("folded lines", function() {1:~ }| ## grid 3 | - ]]} + ]]) else screen:expect([[ {7: }This is a | @@ -2904,7 +2943,7 @@ describe("folded lines", function() command('hi! Visual guibg=Red') feed('V2k') if multigrid then - screen:expect{grid=[[ + screen:expect([[ ## grid 1 [2:------------------------------]| [2:------------------------------]| @@ -2922,7 +2961,7 @@ describe("folded lines", function() {1:~ }| ## grid 3 {11:-- VISUAL LINE --} | - ]]} + ]]) else screen:expect([[ {7: }This is a | -- cgit From 508dda0e6c327a1430fbb0d9a382fe6a848c933e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 18 Sep 2023 07:07:54 +0800 Subject: test(ui/fold_spec): more testing for clicking on 'foldcolumn' (#25225) --- test/functional/ui/fold_spec.lua | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index a371b45e2b..c8ca5be282 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -424,8 +424,82 @@ describe("folded lines", function() ]]) 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([[ -- cgit From 23c21e763074d401e8b36a91e6568bebc1655ce9 Mon Sep 17 00:00:00 2001 From: Ibby <33922797+SleepySwords@users.noreply.github.com> Date: Thu, 21 Sep 2023 00:39:54 +1000 Subject: fix(extmarks): account for rightleft when drawing virt text (#25262) Co-authored-by: zeertzjq --- test/functional/ui/fold_spec.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index c8ca5be282..5e907f82ba 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -3047,6 +3047,39 @@ describe("folded lines", function() {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:--}{7: +│}| + {15:······}{20:.evac sih ni}{19: }{15:--}{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:--}{7: +│}| + {15:······}{20:.evac sih ni}{19: }{15:--}{7: +│}| + {1: ~}| + {1: ~}| + {11:-- VISUAL LINE --} | + ]]) + end end) end -- cgit From 64e8a3c4d19eab40888fbac36b96e97bd9d68c42 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 22 Sep 2023 15:36:24 +0800 Subject: fix(ui): handle virtual text with multiple hl in more cases (#25304) --- test/functional/ui/fold_spec.lua | 45 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 5e907f82ba..f42682ba69 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -33,7 +33,7 @@ describe("folded lines", function() [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}, @@ -2938,10 +2938,15 @@ describe("folded lines", 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', - '[[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') @@ -2958,7 +2963,7 @@ describe("folded lines", function() [3:------------------------------]| ## grid 2 {7: }This is a | - {7:+ }{13:^-}{17: }{18:valid English}{13:·····}| + {7:+ }{4:^▶}{13:-}{17: }{18:valid English}{13:·····}| {1:~ }| {1:~ }| {1:~ }| @@ -2969,7 +2974,7 @@ describe("folded lines", function() else screen:expect([[ {7: }This is a | - {7:+ }{13:^-}{17: }{18:valid English}{13:·····}| + {7:+ }{4:^▶}{13:-}{17: }{18:valid English}{13:·····}| {1:~ }| {1:~ }| {1:~ }| @@ -2977,7 +2982,7 @@ describe("folded lines", function() | ]]) end - eq('-\tvalid English', funcs.foldtextresult(2)) + eq('▶-\tvalid English', funcs.foldtextresult(2)) feed('zo') if multigrid then @@ -2993,8 +2998,8 @@ describe("folded lines", function() ## grid 2 {7: }This is a | {7:- }valid English | - {7:│+ }{5:--}{19: }{18:sentence composed }| - {7:│+ }{13:^--}{17: }{18:in his cave.}{13:······}| + {7:│+ }{4:▶}{5:--}{19: }{18:sentence composed }| + {7:│+ }{4:^▶}{13:--}{17: }{18:in his cave.}{13:······}| {1:~ }| {1:~ }| ## grid 3 @@ -3004,15 +3009,15 @@ describe("folded lines", function() screen:expect([[ {7: }This is a | {7:- }valid English | - {7:│+ }{5:--}{19: }{18:sentence composed }| - {7:│+ }{13:^--}{17: }{18:in his cave.}{13:······}| + {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)) + eq('▶--\tsentence composed by', funcs.foldtextresult(3)) + eq('▶--\tin his cave.', funcs.foldtextresult(5)) command('hi! Visual guibg=Red') feed('V2k') @@ -3029,8 +3034,8 @@ describe("folded lines", function() ## grid 2 {7: }This is a | {7:- }^v{14:alid English} | - {7:│+ }{15:--}{19: }{20:sentence composed }| - {7:│+ }{15:--}{19: }{20:in his cave.}{15:······}| + {7:│+ }{4:▶}{15:--}{19: }{20:sentence composed }| + {7:│+ }{4:▶}{15:--}{19: }{20:in his cave.}{15:······}| {1:~ }| {1:~ }| ## grid 3 @@ -3040,8 +3045,8 @@ describe("folded lines", function() screen:expect([[ {7: }This is a | {7:- }^v{14:alid English} | - {7:│+ }{15:--}{19: }{20:sentence composed }| - {7:│+ }{15:--}{19: }{20:in his cave.}{15:······}| + {7:│+ }{4:▶}{15:--}{19: }{20:sentence composed }| + {7:│+ }{4:▶}{15:--}{19: }{20:in his cave.}{15:······}| {1:~ }| {1:~ }| {11:-- VISUAL LINE --} | @@ -3062,8 +3067,8 @@ describe("folded lines", function() ## grid 2 a si sihT{7: }| {14:hsilgnE dila}^v{7: -}| - {20: desopmoc ecnetnes}{19: }{15:--}{7: +│}| - {15:······}{20:.evac sih ni}{19: }{15:--}{7: +│}| + {20: desopmoc ecnetnes}{19: }{15:--}{4:▶}{7: +│}| + {15:······}{20:.evac sih ni}{19: }{15:--}{4:▶}{7: +│}| {1: ~}| {1: ~}| ## grid 3 @@ -3073,8 +3078,8 @@ describe("folded lines", function() screen:expect([[ a si sihT{7: }| {14:hsilgnE dila}^v{7: -}| - {20: desopmoc ecnetnes}{19: }{15:--}{7: +│}| - {15:······}{20:.evac sih ni}{19: }{15:--}{7: +│}| + {20: desopmoc ecnetnes}{19: }{15:--}{4:▶}{7: +│}| + {15:······}{20:.evac sih ni}{19: }{15:--}{4:▶}{7: +│}| {1: ~}| {1: ~}| {11:-- VISUAL LINE --} | -- cgit From ddef39299f357d3131644647379e88a69749bf40 Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 19 Sep 2023 14:30:02 +0200 Subject: refactor(grid): do arabic shaping in one place The 'arabicshape' feature of vim is a transformation of unicode text to make arabic and some related scripts look better at display time. In particular the content of a cell will be adjusted depending on the (original) content of the cells just before and after it. This is implemented by the arabic_shape() function in nvim. Before this commit, shaping was invoked in four different contexts: - when rendering buffer text in win_line() - in line_putchar() for rendering virtual text - as part of grid_line_puts, used by messages and statuslines and similar - as part of draw_cmdline() for drawing the cmdline This replaces all these with a post-processing step in grid_put_linebuf(), which has become the entry point for all text rendering after recent refactors. An aim of this is to make the handling of multibyte text yet simpler. One of the main reasons multibyte chars needs to be "parsed" into codepoint arrays of composing chars is so that these could be inspected for the purpose of shaping. This can likely be vastly simplified in many contexts where only the total length (in bytes) and width of composed char is needed. --- test/functional/ui/fold_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index f42682ba69..7894c8296b 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -1156,7 +1156,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}| + {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}| {1:~ }| {1:~ }| {1:~ }| @@ -1168,7 +1168,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}| + {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}| {1:~ }| {1:~ }| {1:~ }| @@ -1337,7 +1337,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}| + {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̎͂̀̂͛͛ 语 å :senil 2 --^+}| {1: ~}| {1: ~}| {1: ~}| @@ -1349,7 +1349,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}| + {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̎͂̀̂͛͛ 语 å :senil 2 --^+}| {1: ~}| {1: ~}| {1: ~}| -- cgit From bf70a33f5e7de0218704126c149db24542e39766 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 14 Oct 2023 09:58:30 +0800 Subject: vim-patch:8.1.0822: peeking and flushing output slows down execution (#25629) Problem: Peeking and flushing output slows down execution. Solution: Do not update the mode message when global_busy is set. Do not flush when only peeking for a character. (Ken Takata) https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c --- test/functional/ui/fold_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 7894c8296b..264c0355ae 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -169,10 +169,10 @@ describe("folded lines", function() end -- CursorLine is applied correctly with screenrow motions #22232 feed("jgk") - screen:expect_unchanged(true) + screen:expect_unchanged() -- CursorLine is applied correctly when closing a fold when cursor is not at fold start feed("zo4Gzc") - screen:expect_unchanged(true) + screen:expect_unchanged() command("set cursorlineopt=line") if multigrid then screen:expect([[ -- cgit From d974a3dcbb3757ebeb78fa64054c795ab7acdf1a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 15 Oct 2023 17:19:01 +0800 Subject: vim-patch:9.0.2032: cannot get mouse click pos for tab or virt text (#25653) Problem: Cannot accurately get mouse clicking position when clicking on a TAB or with virtual text. Solution: Add a "coladd" field to getmousepos() result. closes: vim/vim#13335 https://github.com/vim/vim/commit/f5a94d5165bb9e390797da50a1fa7a87df3fbee4 --- test/functional/ui/fold_spec.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 264c0355ae..9a0182ea29 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -2155,13 +2155,14 @@ describe("folded lines", function() meths.input_mouse('left', 'press', '', multigrid and 2 or 0, 4, 0) eq({ - column = 1, - line = 3, screencol = 1, screenrow = 5, - wincol = 1, 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", ""}}} }) -- cgit From b522cb1ac3fbdf6e68eed5d0b6e1cbeaf3ac2254 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 6 Nov 2023 14:52:27 +0100 Subject: refactor(grid): make screen rendering more multibyte than ever before Problem: buffer text with composing chars are converted from UTF-8 to an array of up to seven UTF-32 values and then converted back to UTF-8 strings. Solution: Convert buffer text directly to UTF-8 based schar_T values. The limit of the text size is now in schar_T bytes, which is currently 31+1 but easily could be raised as it no longer multiplies the size of the entire screen grid when not used, the full size is only required for temporary scratch buffers. Also does some general cleanup to win_line text handling, which was unnecessarily complicated due to multibyte rendering being an "opt-in" feature long ago. Nowadays, a char is just a char, regardless if it consists of one ASCII byte or multiple bytes. --- test/functional/ui/fold_spec.lua | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'test/functional/ui/fold_spec.lua') diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 9a0182ea29..1addf7088e 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -1102,8 +1102,6 @@ describe("folded lines", function() end) it("works with multibyte text", function() - -- Currently the only allowed value of 'maxcombine' - eq(6, meths.get_option_value('maxcombine', {})) eq(true, meths.get_option_value('arabicshape', {})) insert([[ å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢͟ العَرَبِيَّة @@ -1120,7 +1118,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ | + å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ | möre tex^t | {1:~ }| {1:~ }| @@ -1132,7 +1130,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ | + å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ | möre tex^t | {1:~ }| {1:~ }| @@ -1156,7 +1154,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}| + {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}| {1:~ }| {1:~ }| {1:~ }| @@ -1168,7 +1166,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}| + {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ ﺎﻠﻋَﺮَﺒِﻳَّﺓ·················}| {1:~ }| {1:~ }| {1:~ }| @@ -1192,7 +1190,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}| + {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ العَرَبِيَّة·················}| {1:~ }| {1:~ }| {1:~ }| @@ -1204,7 +1202,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - {5:^+-- 2 lines: å 语 x̎͂̀̂͛͛ العَرَبِيَّة·················}| + {5:^+-- 2 lines: å 语 x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ العَرَبِيَّة·················}| {1:~ }| {1:~ }| {1:~ }| @@ -1228,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:~ }| @@ -1240,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:~ }| @@ -1265,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: ~}| @@ -1277,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: ~}| @@ -1301,7 +1299,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}| + {5:·················ةيَّبِرَعَلا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}| {1: ~}| {1: ~}| {1: ~}| @@ -1313,7 +1311,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - {5:·················ةيَّبِرَعَلا x̎͂̀̂͛͛ 语 å :senil 2 --^+}| + {5:·················ةيَّبِرَعَلا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}| {1: ~}| {1: ~}| {1: ~}| @@ -1337,7 +1335,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̎͂̀̂͛͛ 语 å :senil 2 --^+}| + {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}| {1: ~}| {1: ~}| {1: ~}| @@ -1349,7 +1347,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̎͂̀̂͛͛ 语 å :senil 2 --^+}| + {5:·················ﺔﻴَّﺑِﺮَﻌَﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å :senil 2 --^+}| {1: ~}| {1: ~}| {1: ~}| @@ -1373,7 +1371,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̎͂̀̂͛͛ 语 å| + ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å| txet eröm| {1: ~}| {1: ~}| @@ -1385,7 +1383,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̎͂̀̂͛͛ 语 å| + ﺔﻴَّﺑِﺮَﻌَ^ﻟﺍ x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å| txet eröm| {1: ~}| {1: ~}| @@ -1409,7 +1407,7 @@ describe("folded lines", function() [2:---------------------------------------------]| [3:---------------------------------------------]| ## grid 2 - ةيَّبِرَعَ^لا x̎͂̀̂͛͛ 语 å| + ةيَّبِرَعَ^لا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å| txet eröm| {1: ~}| {1: ~}| @@ -1421,7 +1419,7 @@ describe("folded lines", function() ]]) else screen:expect([[ - ةيَّبِرَعَ^لا x̎͂̀̂͛͛ 语 å| + ةيَّبِرَعَ^لا x̨̣̘̫̲͚͎̎͂̀̂͛͛̾͢ 语 å| txet eröm| {1: ~}| {1: ~}| -- cgit