From 06ff540e1ca25f4c26670f184d4087f6e3188064 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 6 Dec 2023 07:16:02 +0800 Subject: vim-patch:9.0.2151: 'breakindent' is not drawn after diff filler lines (#26412) Problem: 'breakindent' is not drawn after diff filler lines. Solution: Correct check for whether 'breakindent' should be drawn. closes: vim/vim#13624 https://github.com/vim/vim/commit/588f20decebebedba3ad733f4f443a597e9747c3 Cherry-pick Test_diff_with_syntax() change from patch 9.0.1257. --- test/functional/ui/diff_spec.lua | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 92b7235885..bcd1fc4090 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -11,6 +11,8 @@ local exec = helpers.exec local eq = helpers.eq local meths = helpers.meths +before_each(clear) + describe('Diff mode screen', function() local fname = 'Xtest-functional-diff-screen-1' local fname_2 = fname .. '.2' @@ -21,7 +23,6 @@ describe('Diff mode screen', function() end setup(function() - clear() os.remove(fname) os.remove(fname_2) end) @@ -32,7 +33,6 @@ describe('Diff mode screen', function() end) before_each(function() - clear() feed(':e ' .. fname_2 .. '') feed(':vnew ' .. fname .. '') feed(':diffthis') @@ -1347,7 +1347,6 @@ end) it('win_update redraws lines properly', function() local screen - clear() screen = Screen.new(50, 10) screen:attach() screen:set_default_attr_ids({ @@ -1419,7 +1418,6 @@ end) -- oldtest: Test_diff_rnu() it('diff updates line numbers below filler lines', function() - clear() local screen = Screen.new(40, 14) screen:attach() screen:set_default_attr_ids({ @@ -1496,7 +1494,6 @@ end) -- oldtest: Test_diff_with_scroll_and_change() it('Align the filler lines when changing text in diff mode', function() - clear() local screen = Screen.new(40, 20) screen:attach() screen:set_default_attr_ids({ @@ -1588,7 +1585,6 @@ it('Align the filler lines when changing text in diff mode', function() end) it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function() - clear() local screen = Screen.new(60, 6) screen:set_default_attr_ids({ [0] = {foreground = Screen.colors.Blue, bold = true}; @@ -1609,7 +1605,6 @@ end) -- oldtest: Test_diff_binary() it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', function() - clear() local screen = Screen.new(40, 20) screen:set_default_attr_ids({ [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray}; @@ -1734,3 +1729,33 @@ it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', fun | ]]) end) + +-- oldtest: Test_diff_breakindent_after_filler() +it("diff mode draws 'breakindent' correctly after filler lines", function() + local screen = Screen.new(45, 8) + screen:attach() + screen:set_default_attr_ids({ + [1] = {background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue}; + [2] = {background = Screen.colors.LightBlue}; + [3] = {background = Screen.colors.LightCyan, bold = true, foreground = Screen.colors.Blue}; + [4] = {foreground = Screen.colors.Blue, bold = true}; + }) + exec([[ + set laststatus=0 diffopt+=followwrap breakindent + call setline(1, ['a', ' ' .. repeat('c', 50)]) + vnew + call setline(1, ['a', 'b', ' ' .. repeat('c', 50)]) + windo diffthis + norm! G$ + ]]) + screen:expect([[ + {1: }a │{1: }a | + {1: }{2:b }│{1: }{3:--------------------}| + {1: } cccccccccccccccccc│{1: } cccccccccccccccccc| + {1: } cccccccccccccccccc│{1: } cccccccccccccccccc| + {1: } cccccccccccccc │{1: } ccccccccccccc^c | + {4:~ }│{4:~ }| + {4:~ }│{4:~ }| + | + ]]) +end) -- cgit From 1037ce2e461034a20e35ad59969fd05d5ad68b91 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 9 Dec 2023 20:42:00 +0800 Subject: test: avoid repeated screen lines in expected states This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g --- test/functional/ui/diff_spec.lua | 406 ++++++--------------------------------- 1 file changed, 54 insertions(+), 352 deletions(-) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index bcd1fc4090..71bbb2f003 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -68,12 +68,7 @@ describe('Diff mode screen', function() {1: }5 │{1: }5 | {1: }6 │{1: }6 | {1:+ }{5:+-- 4 lines: 7···}│{1:+ }{5:+-- 4 lines: 7··}| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| + {6:~ }│{6:~ }|*6 {7:') screen:expect([[ {1:+ }{5:^+-- 10 lines: 1···}│{1:+ }{5:+-- 10 lines: 1··}| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| + {6:~ }│{6:~ }|*13 {7:') screen:expect([[ {1:+ }{5:^+-- 10 lines: 1···}│{1:+ }{5:+-- 10 lines: 1··}| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| + {6:~ }│{6:~ }|*13 {7:') screen:expect([[ {1:- }^ │{1:- } | - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| + {6:~ }│{6:~ }|*13 {7:') screen:expect([[ {1:- }^ │{1:- } | - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| + {6:~ }│{6:~ }|*13 {7:') screen:expect([[ {1: }^a │{1: }a | - {1: }{4: }│{1: }{2:-----------------}| - {1: }{4: }│{1: }{2:-----------------}| + {1: }{4: }│{1: }{2:-----------------}|*2 {1: }cd │{1: }cd | {1: }ef │{1: } | {1: }{8:xxx}{9: }│{1: }ef | {6:~ }│{1: }{8:yyy}{9: }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| - {6:~ }│{6:~ }| + {6:~ }│{6:~ }|*7 {7: Date: Wed, 3 Jan 2024 02:09:18 +0100 Subject: refactor: format test/* --- test/functional/ui/diff_spec.lua | 277 ++++++++++++++++++++++----------------- 1 file changed, 156 insertions(+), 121 deletions(-) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 71bbb2f003..e208385e92 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -41,21 +41,21 @@ describe('Diff mode screen', function() screen = Screen.new(40, 16) screen:attach() screen:set_default_attr_ids({ - [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray}, - [2] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1}, - [3] = {reverse = true}, - [4] = {background = Screen.colors.LightBlue}, - [5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, - [6] = {bold = true, foreground = Screen.colors.Blue1}, - [7] = {bold = true, reverse = true}, - [8] = {bold = true, background = Screen.colors.Red}, - [9] = {background = Screen.colors.LightMagenta}, + [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray }, + [2] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }, + [3] = { reverse = true }, + [4] = { background = Screen.colors.LightBlue }, + [5] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, + [6] = { bold = true, foreground = Screen.colors.Blue1 }, + [7] = { bold = true, reverse = true }, + [8] = { bold = true, background = Screen.colors.Red }, + [9] = { background = Screen.colors.LightMagenta }, }) end) it('Add a line in beginning of file 2', function() - write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) - write_file(fname_2, "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) + write_file(fname, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) + write_file(fname_2, '0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) reread() feed(':set diffopt=filler') @@ -90,11 +90,11 @@ describe('Diff mode screen', function() end) it('Add a line in beginning of file 1', function() - write_file(fname, "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) - write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) + write_file(fname, '0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) + write_file(fname_2, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) reread() - feed(":set diffopt=filler") + feed(':set diffopt=filler') screen:expect([[ {1: }{4:^0 }│{1: }{2:-----------------}| {1: }1 │{1: }1 | @@ -109,7 +109,7 @@ describe('Diff mode screen', function() :set diffopt=filler | ]]) - feed(":set diffopt+=internal") + feed(':set diffopt+=internal') screen:expect([[ {1: }{4:^0 }│{1: }{2:-----------------}| {1: }1 │{1: }1 | @@ -126,11 +126,11 @@ describe('Diff mode screen', function() end) it('Add a line at the end of file 2', function() - write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) - write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false) + write_file(fname, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) + write_file(fname_2, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n', false) reread() - feed(":set diffopt=filler") + feed(':set diffopt=filler') screen:expect([[ {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| {1: }5 │{1: }5 | @@ -145,7 +145,7 @@ describe('Diff mode screen', function() :set diffopt=filler | ]]) - feed(":set diffopt+=internal") + feed(':set diffopt+=internal') screen:expect([[ {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| {1: }5 │{1: }5 | @@ -175,11 +175,11 @@ describe('Diff mode screen', function() end) it('Add a line at the end of file 1', function() - write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false) - write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) + write_file(fname, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n', false) + write_file(fname_2, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) reread() - feed(":set diffopt=filler") + feed(':set diffopt=filler') screen:expect([[ {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| {1: }5 │{1: }5 | @@ -194,7 +194,7 @@ describe('Diff mode screen', function() :set diffopt=filler | ]]) - feed(":set diffopt+=internal") + feed(':set diffopt+=internal') screen:expect([[ {1:+ }{5:^+-- 4 lines: 1···}│{1:+ }{5:+-- 4 lines: 1··}| {1: }5 │{1: }5 | @@ -224,8 +224,8 @@ describe('Diff mode screen', function() end) it('Add a line in the middle of file 2, remove on at the end of file 1', function() - write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false) - write_file(fname_2, "1\n2\n3\n4\n4\n5\n6\n7\n8\n9\n10\n", false) + write_file(fname, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n', false) + write_file(fname_2, '1\n2\n3\n4\n4\n5\n6\n7\n8\n9\n10\n', false) reread() feed(':set diffopt=filler') @@ -268,8 +268,8 @@ describe('Diff mode screen', function() end) it('Add a line in the middle of file 1, remove on at the end of file 2', function() - write_file(fname, "1\n2\n3\n4\n4\n5\n6\n7\n8\n9\n10\n", false) - write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n", false) + write_file(fname, '1\n2\n3\n4\n4\n5\n6\n7\n8\n9\n10\n', false) + write_file(fname_2, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n', false) reread() feed(':set diffopt=filler') @@ -523,7 +523,7 @@ int main(int argc, char **argv) it('internal', function() reread() - feed(":set diffopt=internal,filler") + feed(':set diffopt=internal,filler') screen:expect([[ {1: }^def finalize(value│{1: }def finalize(valu| {1: } │{1: } | @@ -581,8 +581,8 @@ int main(int argc, char **argv) end) it('Diff the same file', function() - write_file(fname, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) - write_file(fname_2, "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", false) + write_file(fname, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) + write_file(fname_2, '1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n', false) reread() feed(':set diffopt=filler') @@ -603,8 +603,8 @@ int main(int argc, char **argv) end) it('Diff an empty file', function() - write_file(fname, "", false) - write_file(fname_2, "", false) + write_file(fname, '', false) + write_file(fname_2, '', false) reread() feed(':set diffopt=filler') @@ -625,8 +625,8 @@ int main(int argc, char **argv) end) it('diffopt+=icase', function() - write_file(fname, "a\nb\ncd\n", false) - write_file(fname_2, "A\nb\ncDe\n", false) + write_file(fname, 'a\nb\ncd\n', false) + write_file(fname_2, 'A\nb\ncDe\n', false) reread() feed(':set diffopt=filler,icase') @@ -654,7 +654,8 @@ int main(int argc, char **argv) setup(function() local f1 = 'int main()\n{\n printf("Hello, World!");\n return 0;\n}\n' write_file(fname, f1, false) - local f2 = 'int main()\n{\n if (0)\n {\n printf("Hello, World!");\n return 0;\n }\n}\n' + local f2 = + 'int main()\n{\n if (0)\n {\n printf("Hello, World!");\n return 0;\n }\n}\n' write_file(fname_2, f2, false) feed(':diffupdate!') end) @@ -821,7 +822,9 @@ int main(int argc, char **argv) -- This was scrolling for 'cursorbind' but 'scrollbind' is more important it('scrolling works correctly vim-patch:8.2.5155', function() screen:try_resize(40, 12) - write_file(fname, dedent([[ + write_file( + fname, + dedent([[ line 1 line 2 line 3 @@ -835,8 +838,12 @@ int main(int argc, char **argv) // Common block // two // containing - // four lines]]), false) - write_file(fname_2, dedent([[ + // four lines]]), + false + ) + write_file( + fname_2, + dedent([[ line 1 line 2 line 3 @@ -869,7 +876,9 @@ int main(int argc, char **argv) // Common block // two // containing - // four lines]]), false) + // four lines]]), + false + ) reread() feed('jjjj') @@ -1016,33 +1025,38 @@ AAAB]] it('diffopt+=linematch:20,iwhiteall', function() reread() feed(':set diffopt=internal,filler,linematch:20') - screen:expect{grid=[[ + screen:expect { + grid = [[ {1: }^BB │{1: }BB | {1: }{9: AA}{8:A}{9: }│{1: }{9: AA}{8:B}{9: }| {1: }{2:------------------}│{1: }{4:AAAB }| {6:~ }│{6:~ }|*11 {7:') - screen:expect{grid=[[ + screen:expect { + grid = [[ {1: }^BB │{1: }BB | {1: }{2:------------------}│{1: }{4: AAB }| {1: }{9: AAA }│{1: }{9:AAA}{8:B}{9: }| {6:~ }│{6:~ }|*11 {7:') feed('') feed('') feed('') feed('') - screen:expect{grid=[[ + screen:expect { + grid = [[ {13: }{16:-----------------------}│{13: }{15:1 }| {13: }{16:-----------------------}│{13: }{15: }| {13: }{16:-----------------------}│{13: }{15:^ }| @@ -1184,7 +1212,8 @@ it('win_update redraws lines properly', function() {1:~ }│{1:~ }| {14:left [+] }{12:[No Name] [+] }| | - ]]} + ]], + } end) -- oldtest: Test_diff_rnu() @@ -1192,17 +1221,17 @@ it('diff updates line numbers below filler lines', function() local screen = Screen.new(40, 14) screen:attach() screen:set_default_attr_ids({ - [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray}, - [2] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1}, - [3] = {reverse = true}, - [4] = {background = Screen.colors.LightBlue}, - [5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey}, - [6] = {bold = true, foreground = Screen.colors.Blue1}, - [7] = {bold = true, reverse = true}, - [8] = {bold = true, background = Screen.colors.Red}, - [9] = {background = Screen.colors.LightMagenta}, - [10] = {bold = true, foreground = Screen.colors.Brown}, - [11] = {foreground = Screen.colors.Brown}, + [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray }, + [2] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }, + [3] = { reverse = true }, + [4] = { background = Screen.colors.LightBlue }, + [5] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey }, + [6] = { bold = true, foreground = Screen.colors.Blue1 }, + [7] = { bold = true, reverse = true }, + [8] = { bold = true, background = Screen.colors.Red }, + [9] = { background = Screen.colors.LightMagenta }, + [10] = { bold = true, foreground = Screen.colors.Brown }, + [11] = { foreground = Screen.colors.Brown }, }) exec([[ call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b']) @@ -1265,14 +1294,14 @@ it('Align the filler lines when changing text in diff mode', function() local screen = Screen.new(40, 20) screen:attach() screen:set_default_attr_ids({ - [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray}; - [2] = {background = Screen.colors.LightCyan, foreground = Screen.colors.Blue1, bold = true}; - [3] = {reverse = true}; - [4] = {background = Screen.colors.LightBlue}; - [5] = {background = Screen.colors.LightMagenta}; - [6] = {background = Screen.colors.Red, bold = true}; - [7] = {foreground = Screen.colors.Blue1, bold = true}; - [8] = {reverse = true, bold = true}; + [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray }, + [2] = { background = Screen.colors.LightCyan, foreground = Screen.colors.Blue1, bold = true }, + [3] = { reverse = true }, + [4] = { background = Screen.colors.LightBlue }, + [5] = { background = Screen.colors.LightMagenta }, + [6] = { background = Screen.colors.Red, bold = true }, + [7] = { foreground = Screen.colors.Blue1, bold = true }, + [8] = { reverse = true, bold = true }, }) exec([[ call setline(1, range(1, 15)) @@ -1282,7 +1311,8 @@ it('Align the filler lines when changing text in diff mode', function() wincmd h exe "normal Gl5\" ]]) - screen:expect{grid=[[ + screen:expect { + grid = [[ {1: }{2:------------------}│{1: }{4:6 }| {1: }{2:------------------}│{1: }{4:7 }| {1: }{2:------------------}│{1: }{4:8 }| @@ -1296,9 +1326,11 @@ it('Align the filler lines when changing text in diff mode', function() {7:~ }│{7:~ }|*8 {8:[No Name] [+] }{3:[No Name] [+] }| | - ]]} + ]], + } feed('ax') - screen:expect{grid=[[ + screen:expect { + grid = [[ {1: }{2:------------------}│{1: }{4:6 }| {1: }{2:------------------}│{1: }{4:7 }| {1: }{2:------------------}│{1: }{4:8 }| @@ -1312,9 +1344,11 @@ it('Align the filler lines when changing text in diff mode', function() {7:~ }│{7:~ }|*8 {8:[No Name] [+] }{3:[No Name] [+] }| | - ]]} + ]], + } feed('lay') - screen:expect{grid=[[ + screen:expect { + grid = [[ {1: }{2:-----------------}│{1: }{4:6 }| {1: }{2:-----------------}│{1: }{4:7 }| {1: }{2:-----------------}│{1: }{4:8 }| @@ -1328,13 +1362,14 @@ it('Align the filler lines when changing text in diff mode', function() {7:~ }│{7:~ }|*8 {3:[No Name] [+] }{8:[No Name] [+] }| | - ]]} + ]], + } end) it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function() local screen = Screen.new(60, 6) screen:set_default_attr_ids({ - [0] = {foreground = Screen.colors.Blue, bold = true}; + [0] = { foreground = Screen.colors.Blue, bold = true }, }) screen:attach() eq('0', meths.get_option_value('foldcolumn', {})) @@ -1351,14 +1386,14 @@ end) it('diff mode works properly if file contains NUL bytes vim-patch:8.2.3925', function() local screen = Screen.new(40, 20) screen:set_default_attr_ids({ - [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray}; - [2] = {reverse = true}; - [3] = {background = Screen.colors.LightBlue}; - [4] = {background = Screen.colors.LightMagenta}; - [5] = {background = Screen.colors.Red, bold = true}; - [6] = {foreground = Screen.colors.Blue, bold = true}; - [7] = {background = Screen.colors.Red, foreground = Screen.colors.Blue, bold = true}; - [8] = {reverse = true, bold = true}; + [1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray }, + [2] = { reverse = true }, + [3] = { background = Screen.colors.LightBlue }, + [4] = { background = Screen.colors.LightMagenta }, + [5] = { background = Screen.colors.Red, bold = true }, + [6] = { foreground = Screen.colors.Blue, bold = true }, + [7] = { background = Screen.colors.Red, foreground = Screen.colors.Blue, bold = true }, + [8] = { reverse = true, bold = true }, }) screen:attach() exec([[ @@ -1439,10 +1474,10 @@ it("diff mode draws 'breakindent' correctly after filler lines", function() local screen = Screen.new(45, 8) screen:attach() screen:set_default_attr_ids({ - [1] = {background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue}; - [2] = {background = Screen.colors.LightBlue}; - [3] = {background = Screen.colors.LightCyan, bold = true, foreground = Screen.colors.Blue}; - [4] = {foreground = Screen.colors.Blue, bold = true}; + [1] = { background = Screen.colors.Grey, foreground = Screen.colors.DarkBlue }, + [2] = { background = Screen.colors.LightBlue }, + [3] = { background = Screen.colors.LightCyan, bold = true, foreground = Screen.colors.Blue }, + [4] = { foreground = Screen.colors.Blue, bold = true }, }) exec([[ set laststatus=0 diffopt+=followwrap breakindent -- cgit From c30f2e3182e3b50e7c03932027ac55edfc8ada4a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 12 Jan 2024 12:44:54 +0000 Subject: test: typing for helpers.meths --- test/functional/ui/diff_spec.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index e208385e92..0c9ca6199b 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -1053,7 +1053,7 @@ AAAB]] write_file(fname, 'aaa\nbbb\nccc\n\nxx', false) write_file(fname_2, 'aaa\nbbb\nccc\n\nyy', false) reread() - local buf = meths.get_current_buf() + local buf = meths.nvim_get_current_buf() command('botright new') screen:expect { grid = [[ @@ -1071,7 +1071,7 @@ AAAB]] ]], } - meths.buf_set_lines(buf, 1, 2, true, { 'BBB' }) + meths.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) screen:expect { grid = [[ {1: }aaa │{1: }aaa | @@ -1093,7 +1093,7 @@ AAAB]] write_file(fname, 'aaa\nbbb\nccc\n\nxx', false) write_file(fname_2, 'aaa\nbbb\nccc\n\nyy', false) reread() - local buf = meths.get_current_buf() + local buf = meths.nvim_get_current_buf() command('botright split | diffoff') screen:expect { grid = [[ @@ -1115,7 +1115,7 @@ AAAB]] ]], } - meths.buf_set_lines(buf, 1, 2, true, { 'BBB' }) + meths.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) screen:expect { grid = [[ {1: }aaa │{1: }aaa | @@ -1372,14 +1372,14 @@ it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function() [0] = { foreground = Screen.colors.Blue, bold = true }, }) screen:attach() - eq('0', meths.get_option_value('foldcolumn', {})) + eq('0', meths.nvim_get_option_value('foldcolumn', {})) command('diffsplit | bd') screen:expect([[ ^ | {0:~ }|*4 | ]]) - eq('0', meths.get_option_value('foldcolumn', {})) + eq('0', meths.nvim_get_option_value('foldcolumn', {})) end) -- oldtest: Test_diff_binary() -- cgit From 795f896a5772d5e0795f86642bdf90c82efac45c Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 12 Jan 2024 17:59:57 +0000 Subject: test: rename (meths, funcs) -> (api, fn) --- test/functional/ui/diff_spec.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index 0c9ca6199b..cbb6ee466b 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -9,7 +9,7 @@ local write_file = helpers.write_file local dedent = helpers.dedent local exec = helpers.exec local eq = helpers.eq -local meths = helpers.meths +local api = helpers.api before_each(clear) @@ -1053,7 +1053,7 @@ AAAB]] write_file(fname, 'aaa\nbbb\nccc\n\nxx', false) write_file(fname_2, 'aaa\nbbb\nccc\n\nyy', false) reread() - local buf = meths.nvim_get_current_buf() + local buf = api.nvim_get_current_buf() command('botright new') screen:expect { grid = [[ @@ -1071,7 +1071,7 @@ AAAB]] ]], } - meths.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) + api.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) screen:expect { grid = [[ {1: }aaa │{1: }aaa | @@ -1093,7 +1093,7 @@ AAAB]] write_file(fname, 'aaa\nbbb\nccc\n\nxx', false) write_file(fname_2, 'aaa\nbbb\nccc\n\nyy', false) reread() - local buf = meths.nvim_get_current_buf() + local buf = api.nvim_get_current_buf() command('botright split | diffoff') screen:expect { grid = [[ @@ -1115,7 +1115,7 @@ AAAB]] ]], } - meths.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) + api.nvim_buf_set_lines(buf, 1, 2, true, { 'BBB' }) screen:expect { grid = [[ {1: }aaa │{1: }aaa | @@ -1372,14 +1372,14 @@ it("diff mode doesn't restore invalid 'foldcolumn' value #21647", function() [0] = { foreground = Screen.colors.Blue, bold = true }, }) screen:attach() - eq('0', meths.nvim_get_option_value('foldcolumn', {})) + eq('0', api.nvim_get_option_value('foldcolumn', {})) command('diffsplit | bd') screen:expect([[ ^ | {0:~ }|*4 | ]]) - eq('0', meths.nvim_get_option_value('foldcolumn', {})) + eq('0', api.nvim_get_option_value('foldcolumn', {})) end) -- oldtest: Test_diff_binary() -- cgit From 86458dde0e451dc1d59f16f1d00f2abeb8288ac9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 13 Feb 2024 07:33:24 +0800 Subject: vim-patch:9.1.0103: 'breakindentopt' "min" not correct with 'signcolumn' (#27451) Problem: 'breakindentopt' "min" works incorrectly with 'signcolumn'. Solution: Use win_col_off() and win_col_off2(). (zeertzjq) closes: vim/vim#14014 https://github.com/vim/vim/commit/f0a9d65e0a1d693cdfa964aa72de5b93b4cacdea --- test/functional/ui/diff_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/ui/diff_spec.lua') diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua index cbb6ee466b..e0dfde35f2 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -1480,7 +1480,7 @@ it("diff mode draws 'breakindent' correctly after filler lines", function() [4] = { foreground = Screen.colors.Blue, bold = true }, }) exec([[ - set laststatus=0 diffopt+=followwrap breakindent + set laststatus=0 diffopt+=followwrap breakindent breakindentopt=min:0 call setline(1, ['a', ' ' .. repeat('c', 50)]) vnew call setline(1, ['a', 'b', ' ' .. repeat('c', 50)]) -- cgit