From 31fa064c683ae049fd392b8280e24aa14f0f4fa3 Mon Sep 17 00:00:00 2001 From: Jit Yao Yap Date: Fri, 22 Mar 2019 00:10:57 +0800 Subject: floating-window.c: fix crash when using inccommand --- test/functional/ui/float_spec.lua | 188 +++++++++++++++++++++++++++++++++++++- 1 file changed, 187 insertions(+), 1 deletion(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 79b1da5a48..b1dda2f7a8 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -5,6 +5,7 @@ local clear, feed = helpers.clear, helpers.feed local command, feed_command = helpers.command, helpers.feed_command local eval = helpers.eval local eq = helpers.eq +local insert = helpers.insert local meths = helpers.meths local curbufmeths = helpers.curbufmeths local funcs = helpers.funcs @@ -33,6 +34,7 @@ describe('floating windows', function() [14] = {foreground = Screen.colors.Brown}, [15] = {background = Screen.colors.Grey20}, [16] = {background = Screen.colors.Grey20, bold = true, foreground = Screen.colors.Blue1}, + [17] = {background = Screen.colors.Yellow}, } local function with_ext_multigrid(multigrid) @@ -1106,6 +1108,191 @@ describe('floating windows', function() end end) + it('does not crash with inccommand #9379', function() + screen:try_resize(30,15) + local expected_pos = { + [3]={{id=1001}, 'NW', 1, 2, 0, true}, + } + + command("set inccommand=split") + command("set laststatus=2") + + local buf = meths.create_buf(false,false) + meths.open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) + + insert([[ + foo + bar +]]) + + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + {5:[No Name] }| + | + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + {1:foo }| + {1:bar }| + {1:^ }| + ]], float_pos=expected_pos} + else + screen:expect([[ + | + {0:~ }| + {1:foo }| + {1:bar }| + {1:^ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {5:[No Name] }| + | + ]]) + end + + feed(':%s/.') + + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + {5:[Preview] }| + :%s/.^ | + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + {17:f}{1:oo }| + {17:b}{1:ar }| + {1: }| + ]], float_pos=expected_pos} + else + screen:expect([[ + | + {0:~ }| + {17:f}{1:oo }| + {17:b}{1:ar }| + {1: }| + {5:[No Name] }| + |1| {17:f}oo | + |2| {17:b}ar | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {5:[Preview] }| + :%s/.^ | + ]]) + end + + feed('') + + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + [2:------------------------------]| + {5:[No Name] }| + | + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + {1:foo }| + {1:bar }| + {1:^ }| + ]], float_pos=expected_pos} + else + screen:expect([[ + | + {0:~ }| + {1:foo }| + {1:bar }| + {1:^ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {5:[No Name] }| + | + ]]) + end + end) + it('does not crash when set cmdheight #9680', function() local buf = meths.create_buf(false,false) meths.open_win(buf, false, {relative='editor', width=20, height=2, row=2, col=5}) @@ -3456,6 +3643,5 @@ describe('floating windows', function() describe('without ext_multigrid', function() with_ext_multigrid(false) end) - end) -- cgit From 2a618e0ad03ecdc672f33df63f8542052ae9bfc4 Mon Sep 17 00:00:00 2001 From: Jit Yao Yap Date: Fri, 22 Mar 2019 01:12:20 +0800 Subject: Update test --- test/functional/ui/float_spec.lua | 187 ++++++++++++-------------------------- 1 file changed, 59 insertions(+), 128 deletions(-) (limited to 'test/functional/ui/float_spec.lua') diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index b1dda2f7a8..4a89345ee5 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -1109,7 +1109,6 @@ describe('floating windows', function() end) it('does not crash with inccommand #9379', function() - screen:try_resize(30,15) local expected_pos = { [3]={{id=1001}, 'NW', 1, 2, 0, true}, } @@ -1121,42 +1120,26 @@ describe('floating windows', function() meths.open_win(buf, true, {relative='editor', width=30, height=3, row=2, col=0}) insert([[ - foo - bar -]]) + foo + bar + ]]) if multigrid then screen:expect{grid=[[ ## grid 1 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - {5:[No Name] }| - | - ## grid 2 - | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + {5:[No Name] }| + | + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| ## grid 3 {1:foo }| {1:bar }| @@ -1164,21 +1147,13 @@ describe('floating windows', function() ]], float_pos=expected_pos} else screen:expect([[ - | - {0:~ }| - {1:foo }| - {1:bar }| - {1:^ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {5:[No Name] }| - | + | + {0:~ }| + {1:foo }{0: }| + {1:bar }{0: }| + {1:^ }{0: }| + {5:[No Name] }| + | ]]) end @@ -1187,27 +1162,15 @@ describe('floating windows', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - {5:[Preview] }| - :%s/.^ | - ## grid 2 - | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + {5:[Preview] }| + :%s/.^ | + ## grid 2 + | ## grid 3 {17:f}{1:oo }| {17:b}{1:ar }| @@ -1215,21 +1178,13 @@ describe('floating windows', function() ]], float_pos=expected_pos} else screen:expect([[ - | - {0:~ }| - {17:f}{1:oo }| - {17:b}{1:ar }| - {1: }| - {5:[No Name] }| - |1| {17:f}oo | - |2| {17:b}ar | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {5:[Preview] }| - :%s/.^ | + | + {5:[No Name] }| + {17:f}{1:oo } | + {17:b}{1:ar } | + {1: }{0: }| + {5:[Preview] }| + :%s/.^ | ]]) end @@ -1238,35 +1193,19 @@ describe('floating windows', function() if multigrid then screen:expect{grid=[[ ## grid 1 - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - [2:------------------------------]| - {5:[No Name] }| - | - ## grid 2 - | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + {5:[No Name] }| + | + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| ## grid 3 {1:foo }| {1:bar }| @@ -1274,21 +1213,13 @@ describe('floating windows', function() ]], float_pos=expected_pos} else screen:expect([[ - | - {0:~ }| - {1:foo }| - {1:bar }| - {1:^ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {5:[No Name] }| - | + | + {0:~ }| + {1:foo }{0: }| + {1:bar }{0: }| + {1:^ }{0: }| + {5:[No Name] }| + | ]]) end end) -- cgit