diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2025-02-21 02:02:32 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2025-02-26 23:06:22 +0100 |
commit | be1fbe38b31b6046d396407c4efbf238941c6b08 (patch) | |
tree | 697a429f5ac903d766c2faaf5044fa7a16eeea77 /test/functional/ui | |
parent | f4921e2b7deb4812414998a521c33f920f571c20 (diff) | |
download | rneovim-be1fbe38b31b6046d396407c4efbf238941c6b08.tar.gz rneovim-be1fbe38b31b6046d396407c4efbf238941c6b08.tar.bz2 rneovim-be1fbe38b31b6046d396407c4efbf238941c6b08.zip |
feat(lua): vim.text.indent()
Problem:
Indenting text is a common task in plugins/scripts for
presentation/formatting, yet vim has no way of doing it (especially
"dedent", and especially non-buffer text).
Solution:
Introduce `vim.text.indent()`. It sets the *exact* indentation because
that's a more difficult (and thus more useful) task than merely
"increasing the current indent" (which is somewhat easy with a `gsub()`
one-liner).
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/float_spec.lua | 20 | ||||
-rw-r--r-- | test/functional/ui/hlstate_spec.lua | 4 | ||||
-rw-r--r-- | test/functional/ui/inccommand_user_spec.lua | 218 | ||||
-rw-r--r-- | test/functional/ui/linematch_spec.lua | 69 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 25 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 5 | ||||
-rw-r--r-- | test/functional/ui/searchhl_spec.lua | 42 |
7 files changed, 184 insertions, 199 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 8155559d66..6610d25afb 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -2041,11 +2041,11 @@ describe('float window', function() [2:----------------------------------------]|*6 [3:----------------------------------------]| ## grid 2 - neeed some dummy | - background text | - to show the effect | - of color blending | - of border shadow | + neeed some dummy | + background text | + to show the effect | + of color blending | + of border shadow | ^ | ## grid 3 | @@ -2065,11 +2065,11 @@ describe('float window', function() }} else screen:expect{grid=[[ - neeed some dummy | - background text | - to {1: halloj! }{23:e}ffect | - of {1: BORDAA }{24:n}ding | - of {23:b}{24:order sha}dow | + neeed some dummy | + background text | + to sh{1: halloj! }{23:f}ect | + of co{1: BORDAA }{24:i}ng | + of bo{23:r}{24:der shado}w | ^ | | ]]} diff --git a/test/functional/ui/hlstate_spec.lua b/test/functional/ui/hlstate_spec.lua index e10c79fa48..e5b0d29f95 100644 --- a/test/functional/ui/hlstate_spec.lua +++ b/test/functional/ui/hlstate_spec.lua @@ -502,9 +502,7 @@ describe('ext_hlstate detailed highlights', function() local num_lines = 500 insert('first line\n') for _ = 1, num_lines do - insert([[ - line - ]]) + api.nvim_paste(' line\n', false, -1) end insert('last line') diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua index 3eee9a6e07..5d604d22d7 100644 --- a/test/functional/ui/inccommand_user_spec.lua +++ b/test/functional/ui/inccommand_user_spec.lua @@ -281,14 +281,14 @@ describe("'inccommand' for user commands", function() ]]) feed('<Esc>') screen:expect([[ - text on line 1 | - more text on line 2 | - oh no, even more text | - will the text ever stop | - oh well | - did the text stop | - why won't it stop | - make the text stop | + text on line 1 | + more text on line 2 | + oh no, even more text | + will the text ever stop | + oh well | + did the text stop | + why won't it stop | + make the text stop | ^ | {1:~ }|*7 | @@ -301,14 +301,14 @@ describe("'inccommand' for user commands", function() command('set inccommand=nosplit') feed(':Replace text cats') screen:expect([[ - {10:cats} on line 1 | - more {10:cats} on line 2 | - oh no, even more {10:cats} | - will the {10:cats} ever stop | - oh well | - did the {10:cats} stop | - why won't it stop | - make the {10:cats} stop | + {10:cats} on line 1 | + more {10:cats} on line 2 | + oh no, even more {10:cats} | + will the {10:cats} ever stop | + oh well | + did the {10:cats} stop | + why won't it stop | + make the {10:cats} stop | | {1:~ }|*7 :Replace text cats^ | @@ -319,21 +319,21 @@ describe("'inccommand' for user commands", function() command('set inccommand=split') feed(':Replace text cats') screen:expect([[ - {10:cats} on line 1 | - more {10:cats} on line 2 | - oh no, even more {10:cats} | - will the {10:cats} ever stop | - oh well | - did the {10:cats} stop | - why won't it stop | - make the {10:cats} stop | + {10:cats} on line 1 | + more {10:cats} on line 2 | + oh no, even more {10:cats} | + will the {10:cats} ever stop | + oh well | + did the {10:cats} stop | + why won't it stop | + make the {10:cats} stop | | {3:[No Name] [+] }| - |1| {10:cats} on line 1 | - |2| more {10:cats} on line 2 | - |3| oh no, even more {10:cats} | - |4| will the {10:cats} ever stop | - |6| did the {10:cats} stop | + |1| {10:cats} on line 1 | + |2| more {10:cats} on line 2 | + |3| oh no, even more {10:cats} | + |4| will the {10:cats} ever stop | + |6| did the {10:cats} stop | {2:[Preview] }| :Replace text cats^ | ]]) @@ -343,14 +343,14 @@ describe("'inccommand' for user commands", function() command('set inccommand=split') feed(':Replace text cats<Esc>') screen:expect([[ - text on line 1 | - more text on line 2 | - oh no, even more text | - will the text ever stop | - oh well | - did the text stop | - why won't it stop | - make the text stop | + text on line 1 | + more text on line 2 | + oh no, even more text | + will the text ever stop | + oh well | + did the text stop | + why won't it stop | + make the text stop | ^ | {1:~ }|*7 | @@ -361,14 +361,14 @@ describe("'inccommand' for user commands", function() command('set inccommand=split') feed(':Replace text cats<CR>') screen:expect([[ - cats on line 1 | - more cats on line 2 | - oh no, even more cats | - will the cats ever stop | - oh well | - did the cats stop | - why won't it stop | - make the cats stop | + cats on line 1 | + more cats on line 2 | + oh no, even more cats | + will the cats ever stop | + oh well | + did the cats stop | + why won't it stop | + make the cats stop | ^ | {1:~ }|*7 :Replace text cats | @@ -379,14 +379,14 @@ describe("'inccommand' for user commands", function() command('set inccommand=split') feed('gg:.Replace text cats') screen:expect([[ - {10:cats} on line 1 | - more text on line 2 | - oh no, even more text | - will the text ever stop | - oh well | - did the text stop | - why won't it stop | - make the text stop | + {10:cats} on line 1 | + more text on line 2 | + oh no, even more text | + will the text ever stop | + oh well | + did the text stop | + why won't it stop | + make the text stop | | {1:~ }|*7 :.Replace text cats^ | @@ -432,14 +432,14 @@ describe("'inccommand' for user commands", function() ]]) feed(':C') screen:expect([[ - {10: cats on line 1} | - more cats on line 2 | - oh no, even more cats | - will the cats ever stop | - oh well | - did the cats stop | - why won't it stop | - make the cats stop | + {10:cats on line 1} | + more cats on line 2 | + oh no, even more cats | + will the cats ever stop | + oh well | + did the cats stop | + why won't it stop | + make the cats stop | | {1:~ }|*7 :C^ | @@ -482,42 +482,42 @@ describe("'inccommand' for user commands", function() ]]) feed(':Test a.a.a.a.') screen:expect([[ - text on line 1 | - more text on line 2 | - oh no, even more text | - will the text ever stop | - oh well | - did the text stop | - why won't it stop | - make the text stop | + text on line 1 | + more text on line 2 | + oh no, even more text | + will the text ever stop | + oh well | + did the text stop | + why won't it stop | + make the text stop | a.a.a.a. | {1:~ }|*7 :Test a.a.a.a.^ | ]]) feed('<C-V><Esc>u') screen:expect([[ - text on line 1 | - more text on line 2 | - oh no, even more text | - will the text ever stop | - oh well | - did the text stop | - why won't it stop | - make the text stop | + text on line 1 | + more text on line 2 | + oh no, even more text | + will the text ever stop | + oh well | + did the text stop | + why won't it stop | + make the text stop | a.a.a. | {1:~ }|*7 :Test a.a.a.a.{18:^[}u^ | ]]) feed('<Esc>') screen:expect([[ - text on line 1 | - more text on line 2 | - oh no, even more text | - will the text ever stop | - oh well | - did the text stop | - why won't it stop | - make the text stop | + text on line 1 | + more text on line 2 | + oh no, even more text | + will the text ever stop | + oh well | + did the text stop | + why won't it stop | + make the text stop | ^ | {1:~ }|*7 | @@ -572,12 +572,12 @@ describe("'inccommand' for user commands", function() screen:expect({ grid = [[ Preview | - oh no, even more text | - will the text ever stop | - oh well | - did the text stop | - why won't it stop | - make the text stop | + oh no, even more text | + will the text ever stop | + oh well | + did the text stop | + why won't it stop | + make the text stop | | {1:~ }|*8 :Test barb^az | @@ -611,9 +611,9 @@ describe("'inccommand' with multiple buffers", function() command('set inccommand=nosplit') feed(':Replace foo bar') screen:expect([[ - bar baz {10:bar} │ {10:bar} bar baz | - baz {10:bar} bar │ bar baz {10:bar} | - {10:bar} bar baz │ baz {10:bar} bar | + bar baz {10:bar} │{10:bar} bar baz | + baz {10:bar} bar │bar baz {10:bar} | + {10:bar} bar baz │baz {10:bar} bar | │ | {1:~ }│{1:~ }|*11 {3:[No Name] [+] }{2:[No Name] [+] }| @@ -621,9 +621,9 @@ describe("'inccommand' with multiple buffers", function() ]]) feed('<CR>') screen:expect([[ - bar baz bar │ bar bar baz | - baz bar bar │ bar baz bar | - bar bar baz │ baz bar bar | + bar baz bar │bar bar baz | + baz bar bar │bar baz bar | + bar bar baz │baz bar bar | ^ │ | {1:~ }│{1:~ }|*11 {3:[No Name] [+] }{2:[No Name] [+] }| @@ -635,19 +635,19 @@ describe("'inccommand' with multiple buffers", function() command('set inccommand=split') feed(':Replace foo bar') screen:expect([[ - bar baz {10:bar} │ {10:bar} bar baz | - baz {10:bar} bar │ bar baz {10:bar} | - {10:bar} bar baz │ baz {10:bar} bar | + bar baz {10:bar} │{10:bar} bar baz | + baz {10:bar} bar │bar baz {10:bar} | + {10:bar} bar baz │baz {10:bar} bar | │ | {3:[No Name] [+] }{2:[No Name] [+] }| Buffer #1: | - |1| {10:bar} bar baz | - |2| bar baz {10:bar} | - |3| baz {10:bar} bar | + |1| {10:bar} bar baz | + |2| bar baz {10:bar} | + |3| baz {10:bar} bar | Buffer #2: | - |1| bar baz {10:bar} | - |2| baz {10:bar} bar | - |3| {10:bar} bar baz | + |1| bar baz {10:bar} | + |2| baz {10:bar} bar | + |3| {10:bar} bar baz | | {1:~ }| {2:[Preview] }| @@ -655,9 +655,9 @@ describe("'inccommand' with multiple buffers", function() ]]) feed('<CR>') screen:expect([[ - bar baz bar │ bar bar baz | - baz bar bar │ bar baz bar | - bar bar baz │ baz bar bar | + bar baz bar │bar bar baz | + baz bar bar │bar baz bar | + bar bar baz │baz bar bar | ^ │ | {1:~ }│{1:~ }|*11 {3:[No Name] [+] }{2:[No Name] [+] }| diff --git a/test/functional/ui/linematch_spec.lua b/test/functional/ui/linematch_spec.lua index 3593604c49..dc16036f21 100644 --- a/test/functional/ui/linematch_spec.lua +++ b/test/functional/ui/linematch_spec.lua @@ -95,8 +95,7 @@ describe('Diff mode screen with 3 diffs open', function() {7: }{8: 9 }{4: BBB }│{7: }{8: 9 }{4: BBB }│{7: }{8: }{23:---------------------------}| {7: }{8: 10 }{4: BBB }│{7: }{8: 10 }{4: BBB }│{7: }{8: }{23:---------------------------}| {7: }{8: 11 }{4:>>>>>>> branch1 }│{7: }{8: 11 }{4:>>>>>>> branch1 }│{7: }{8: }{23:---------------------------}| - {7: }{8: 12 } │{7: }{8: 12 } │{7: }{8: 6 } | - {1:~ }│{1:~ }│{1:~ }|*2 + {1:~ }│{1:~ }│{1:~ }|*3 {3:<-functional-diff-screen-1.3 [+] }{2:<est-functional-diff-screen-1.2 Xtest-functional-diff-screen-1 }| :2,6diffget screen-1.2 | ]]) @@ -114,8 +113,7 @@ describe('Diff mode screen with 3 diffs open', function() {7: }{8: 4 }{4: }{27:BBB}{4: }│{7: }{8: 6 }{4: }{27:BBB}{4: }│{7: }{8: 4 }{4: }{27:AAA}{4: }| {7: }{8: 5 }{4: }{27:BBB}{4: }│{7: }{8: 7 }{4: }{27:BBB}{4: }│{7: }{8: 5 }{4: }{27:AAA}{4: }| {7: }{8: }{23:---------------------------}│{7: }{8: 8 }{22:>>>>>>> branch1 }│{7: }{8: }{23:---------------------------}| - {7: }{8: 6 } │{7: }{8: 9 } │{7: }{8: 6 } | - {1:~ }│{1:~ }│{1:~ }|*5 + {1:~ }│{1:~ }│{1:~ }|*6 {2:<test-functional-diff-screen-1.3 }{3:<functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :5,7diffget screen-1.3 | ]]) @@ -136,8 +134,7 @@ describe('Diff mode screen with 3 diffs open', function() {7: }{8: 4 } BBB │{7: }{8: 9 } BBB │{7: }{8: 8 } BBB | {7: }{8: 5 } BBB │{7: }{8: 10 } BBB │{7: }{8: 9 } BBB | {7: }{8: }{23:---------------------------}│{7: }{8: 11 }{4:>>>>>>> branch1 }│{7: }{8: 10 }{4:>>>>>>> branch1 }| - {7: }{8: 6 } │{7: }{8: 12 } │{7: }{8: 11 } | - {1:~ }│{1:~ }│{1:~ }|*2 + {1:~ }│{1:~ }│{1:~ }|*3 {2:<test-functional-diff-screen-1.3 <est-functional-diff-screen-1.2 }{3:<st-functional-diff-screen-1 [+] }| :5,6diffget screen-1.2 | ]]) @@ -158,8 +155,7 @@ describe('Diff mode screen with 3 diffs open', function() {7: }{8: 4 }{4: BBB }│{7: }{8: 9 }{4: BBB }│{7: }{8: }{23:---------------------------}| {7: }{8: 5 } BBB │{7: }{8: 10 } BBB │{7: }{8: 7 } BBB | {7: }{8: }{23:---------------------------}│{7: }{8: 11 }{22:>>>>>>> branch1 }│{7: }{8: }{23:---------------------------}| - {7: }{8: 6 } │{7: }{8: 12 } │{7: }{8: 8 } | - {1:~ }│{1:~ }│{1:~ }|*2 + {1:~ }│{1:~ }│{1:~ }|*3 {2:<test-functional-diff-screen-1.3 }{3:<est-functional-diff-screen-1.2 }{2:<st-functional-diff-screen-1 [+] }| :6,8diffput screen-1 | ]]) @@ -179,8 +175,7 @@ describe('Diff mode screen with 3 diffs open', function() {7: }{8: 4 } BBB │{7: }{8: 9 } BBB │{7: }{8: 8 } BBB | {7: }{8: 5 } BBB │{7: }{8: 10 } BBB │{7: }{8: 9 } BBB | {7: }{8: }{23:---------------------------}│{7: }{8: 11 }{4:>>>>>>> branch1 }│{7: }{8: 10 }{4:>>>>>>> branch1 }| - {7: }{8: 6 } │{7: }{8: 12 } │{7: }{8: 11 } | - {1:~ }│{1:~ }│{1:~ }|*2 + {1:~ }│{1:~ }│{1:~ }|*3 {2:<test-functional-diff-screen-1.3 }{3:<est-functional-diff-screen-1.2 }{2:<st-functional-diff-screen-1 [+] }| :6,11diffput screen-1 | ]]) @@ -276,8 +271,7 @@ something {7: }{8: 14 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 15 }something │{7: }{8: 17 }something | - {7: }{8: 16 } │{7: }{8: 18 } | - {1:~ }│{1:~ }|*6 + {1:~ }│{1:~ }|*7 {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :5,9diffget | ]]) @@ -300,8 +294,7 @@ something {7: }{8: 11 }common line │{7: }{8: 12 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 13 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 14 }something | - {7: }{8: 13 } │{7: }{8: 15 } | - {1:~ }│{1:~ }|*3 + {1:~ }│{1:~ }|*4 {2:Xtest-functional-diff-screen-1.2 }{3:Xtest-functional-diff-screen-1 [+] }| :5,10diffget | ]]) @@ -322,8 +315,7 @@ something {7: }{8: 10 }common line │{7: }{8: 10 }common line | {7: }{8: 11 }common line │{7: }{8: 11 }common line | {7: }{8: 12 }something │{7: }{8: 12 }something | - {7: }{8: 13 } │{7: }{8: 13 } | - {1:~ }│{1:~ }|*5 + {1:~ }│{1:~ }|*6 {2:Xtest-functional-diff-screen-1.2 }{3:Xtest-functional-diff-screen-1 [+] }| :4,17diffget | ]]) @@ -349,7 +341,7 @@ something {7: }{8: 15 }common line │{7: }{8: 15 }common line | {7: }{8: 16 }DEF │{7: }{8: 16 }DEF | {7: }{8: 17 }something │{7: }{8: 17 }something | - {7: }{8: 18 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :4,12diffget | ]]) @@ -376,7 +368,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 17 }something | - {7: }{8: 13 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -403,7 +395,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 17 }something | - {7: }{8: 13 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -430,7 +422,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 17 }something | - {7: }{8: 13 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -457,7 +449,7 @@ something {7: }{8: 12 }^common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 13 }something │{7: }{8: 17 }something | - {7: }{8: 14 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -484,7 +476,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: 12 }DEF │{7: }{8: 16 }DEF | {7: }{8: 13 }^something │{7: }{8: 17 }something | - {7: }{8: 14 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -511,7 +503,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 17 }something | - {7: }{8: 13 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 [+] }| :e | ]]) @@ -538,7 +530,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 17 }something | - {7: }{8: 13 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 [+] }| :e | ]]) @@ -565,7 +557,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 17 }something | - {7: }{8: 13 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 [+] }| :e | ]]) @@ -591,7 +583,7 @@ something {7: }{8: 11 }^common line │{7: }{8: 14 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 15 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 16 }something | - {7: }{8: 13 } │{7: }{8: 17 } | + {1:~ }│{1:~ }| {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 [+] }| :e | @@ -618,7 +610,7 @@ something {7: }{8: }{23:-------------------------------------------}│{7: }{8: 14 }{22:DEF }| {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: 12 }^something │{7: }{8: 16 }something | - {7: }{8: 13 } │{7: }{8: 17 } | + {1:~ }│{1:~ }| {1:~ }│{1:~ }| {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 [+] }| :e | @@ -646,7 +638,7 @@ something {7: }{8: 14 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 15 }something │{7: }{8: 17 }something | - {7: }{8: 16 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {2:Xtest-functional-diff-screen-1.2 [+] }{3:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -673,7 +665,7 @@ something {7: }{8: 14 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 15 }something │{7: }{8: 17 }something | - {7: }{8: 16 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {2:Xtest-functional-diff-screen-1.2 [+] }{3:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -700,7 +692,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: }{23:-------------------------------------------}│{7: }{8: 16 }{22:DEF }| {7: }{8: 12 }something │{7: }{8: 17 }something | - {7: }{8: 13 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {2:Xtest-functional-diff-screen-1.2 [+] }{3:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -727,7 +719,7 @@ something {7: }{8: 11 }common line │{7: }{8: 15 }common line | {7: }{8: 12 }DEF │{7: }{8: 16 }DEF | {7: }{8: 13 }something │{7: }{8: 17 }^something | - {7: }{8: 14 } │{7: }{8: 18 } | + {1:~ }│{1:~ }| {2:Xtest-functional-diff-screen-1.2 [+] }{3:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -757,8 +749,7 @@ d {7: }{8: 2 }{4:abc d }│{7: }{8: 1 }{27:// }{4:abc d }| {7: }{8: 3 }{4:d }│{7: }{8: 2 }{27:// }{4:d }| {7: }{8: }{23:-------------------------------------------}│{7: }{8: 3 }{22:// d }| - {7: }{8: 4 } │{7: }{8: 4 } | - {1:~ }│{1:~ }|*13 + {1:~ }│{1:~ }|*14 {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -794,8 +785,7 @@ void testFunction () { {7: }{8: 3 }{4: }{27:// }{4:} }│{7: }{8: 4 }{4: } }| {7: }{8: }{23:-------------------------------------------}│{7: }{8: 5 }{22: } }| {7: }{8: 4 }} │{7: }{8: 6 }} | - {7: }{8: 5 } │{7: }{8: 7 } | - {1:~ }│{1:~ }|*11 + {1:~ }│{1:~ }|*12 {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -834,8 +824,7 @@ void testFunction () { {7: }{8: 6 }{22:?B }│{7: }{8: }{23:--------------------------------------------}| {7: }{8: 7 }{22:?B }│{7: }{8: }{23:--------------------------------------------}| {7: }{8: 8 }{22:?C }│{7: }{8: }{23:--------------------------------------------}| - {7: }{8: 9 } │{7: }{8: 4 } | - {1:~ }│{1:~ }|*9 + {1:~ }│{1:~ }|*10 {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -874,8 +863,7 @@ void testFunction () { {7: }{8: 6 }{27:?}{4:B }│{7: }{8: 2 }{27:!}{4:B }| {7: }{8: 7 }{27:?}{4:C }│{7: }{8: 3 }{27:!}{4:C }| {7: }{8: 8 }{22:?C }│{7: }{8: }{23:--------------------------------------------}| - {7: }{8: 9 } │{7: }{8: 4 } | - {1:~ }│{1:~ }|*9 + {1:~ }│{1:~ }|*10 {3:Xtest-functional-diff-screen-1.2 }{2:Xtest-functional-diff-screen-1 }| :e | ]]) @@ -1017,8 +1005,7 @@ something {7: }{8: 9 }HIL │{7: }{8: 9 }HIL | {7: }{8: 10 }common line │{7: }{8: 10 }common line | {7: }{8: 11 }something │{7: }{8: 11 }something | - {7: }{8: 12 } │{7: }{8: 12 } | - {1:~ }│{1:~ }|*6 + {1:~ }│{1:~ }|*7 {3:Xtest-functional-diff-screen-1.2 [+] }{2:Xtest-functional-diff-screen-1 }| :1,19diffget | ]]) diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index fe093b67d5..375bc560dc 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -2318,25 +2318,26 @@ describe('builtin popupmenu', function() command('set completeopt+=noinsert') command('set mouse=a') insert([[ - Lorem ipsum dolor sit amet, consectetur - adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. - Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex - ea commodo consequat. Duis aute irure dolor in - reprehenderit in voluptate velit esse cillum - dolore eu fugiat nulla pariatur. Excepteur sint - occaecat cupidatat non proident, sunt in culpa - qui officia deserunt mollit anim id est - laborum. + Lorem ipsum dolor sit amet, consectetur + adipisicing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. + Ut enim ad minim veniam, quis nostrud + exercitation ullamco laboris nisi ut aliquip ex + ea commodo consequat. Duis aute irure dolor in + reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa + qui officia deserunt mollit anim id est + laborum. + . ]]) screen:expect([[ - reprehenderit in voluptate velit esse cillum | dolore eu fugiat nulla pariatur. Excepteur sint | occaecat cupidatat non proident, sunt in culpa | qui officia deserunt mollit anim id est | laborum. | + . | ^ | {4:[No Name] [+] }| Lorem ipsum dolor sit amet, consectetur | diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 934b4e9032..adc3080586 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -494,9 +494,8 @@ function Screen:expect(expected, attr_ids, ...) local expected_rows = {} --- @type string[] if grid then - -- Remove the last line and dedent. Note that gsub returns more then one - -- value. - grid = dedent(grid:gsub('\n[ ]+$', ''), 0) + -- Dedent (ignores last line if it is blank). + grid = dedent(grid, 0) for row in grid:gmatch('[^\n]+') do table.insert(expected_rows, row) end diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 86490b4527..5479cf6ee6 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -73,10 +73,10 @@ describe('search highlighting', function() -- 'hlsearch' is enabled by default. #2859 feed('gg/text<cr>') screen:expect([[ - some {2:^text} | - more {2:text}stuff | - stupid{2:texttext}stuff | - a {2:text} word | + some {2:^text} | + more {2:text}stuff | + stupid{2:texttext}stuff | + a {2:text} word | | {1:~ }| /text | @@ -85,10 +85,10 @@ describe('search highlighting', function() -- overlapping matches not allowed feed('3nx') screen:expect([[ - some {2:text} | - more {2:text}stuff | - stupid{2:text}^extstuff | - a {2:text} word | + some {2:text} | + more {2:text}stuff | + stupid{2:text}^extstuff | + a {2:text} word | | {1:~ }| /text | @@ -96,10 +96,10 @@ describe('search highlighting', function() feed('ggn*') -- search for entire word screen:expect([[ - some {2:text} | - more textstuff | - stupidtextextstuff | - a {2:^text} word | + some {2:text} | + more textstuff | + stupidtextextstuff | + a {2:^text} word | | {1:~ }| /\<text\> | @@ -107,10 +107,10 @@ describe('search highlighting', function() feed_command('nohlsearch') screen:expect([[ - some text | - more textstuff | - stupidtextextstuff | - a ^text word | + some text | + more textstuff | + stupidtextextstuff | + a ^text word | | {1:~ }| :nohlsearch | @@ -641,7 +641,7 @@ describe('search highlighting', function() feed_command('/ial te') screen:expect { grid = [[ - very {5:spec^ial}{2: te}{6:xt} | + very {5:spec^ial}{2: te}{6:xt} | | {1:~ }|*4 {4:search hit BOTTOM, continuing at TOP} | @@ -652,7 +652,7 @@ describe('search highlighting', function() topline = 0, botline = 3, curline = 0, - curcol = 11, + curcol = 9, linecount = 2, sum_scroll_delta = 0, }, @@ -670,7 +670,7 @@ describe('search highlighting', function() } command('%foldopen') screen:expect([[ - very {5:spec^ial}{2: te}{6:xt} | + very {5:spec^ial}{2: te}{6:xt} | | {1:~ }|*4 {4:search hit BOTTOM, continuing at TOP} | @@ -678,7 +678,7 @@ describe('search highlighting', function() feed_command('call clearmatches()') screen:expect([[ - very spec{2:^ial te}xt | + very spec{2:^ial te}xt | | {1:~ }|*4 :call clearmatches() | @@ -688,7 +688,7 @@ describe('search highlighting', function() -- nonconflicting attributes are combined feed_command('syntax keyword MyGroup special') screen:expect([[ - very {5:spec}{7:^ial}{2: te}xt | + very {5:spec}{7:^ial}{2: te}xt | | {1:~ }|*4 :syntax keyword MyGroup special | |