From 1070c092c7bf989f261047b861165e61e94c1941 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 18 Sep 2019 18:22:38 +0200 Subject: win_update: fix redraw regression (#11027) Before 6e9ea5adc `win_ins_lines` would return `FAIL` for `i/line_count == 0`. Handle this by checking it in the outer `if`. Ref: https://github.com/neovim/neovim/commit/6e9ea5ad#commitcomment-35084669 --- test/functional/ui/diff_spec.lua | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (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 8eb2bbf779..572ed5c695 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -3,6 +3,8 @@ local Screen = require('test.functional.ui.screen') local feed = helpers.feed local clear = helpers.clear +local command = helpers.command +local insert = helpers.insert local write_file = helpers.write_file describe('Diff mode screen', function() @@ -957,3 +959,75 @@ int main(int argc, char **argv) end) end) end) + +it('win_update redraws lines properly', function() + local screen + clear() + screen = Screen.new(30, 10) + screen:attach() + screen:set_default_attr_ids({ + [1] = {bold = true, foreground = Screen.colors.Blue1}, + [2] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, + [3] = {background = Screen.colors.Red, foreground = Screen.colors.Grey100, special = Screen.colors.Yellow}, + [4] = {bold = true, foreground = Screen.colors.SeaGreen4}, + [5] = {special = Screen.colors.Yellow}, + [6] = {special = Screen.colors.Yellow, bold = true, foreground = Screen.colors.SeaGreen4}, + [7] = {foreground = Screen.colors.Grey0, background = Screen.colors.Grey100}, + [8] = {foreground = Screen.colors.Gray90, background = Screen.colors.Grey100}, + [9] = {foreground = tonumber('0x00000c'), background = Screen.colors.Grey100}, + [10] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0xe5e5ff')}, + [11] = {background = Screen.colors.Grey100, bold = true, foreground = tonumber('0x2b8452')}, + [12] = {bold = true, reverse = true}, + [13] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray}, + [14] = {reverse = true}, + [15] = {background = Screen.colors.LightBlue}, + [16] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1}, + [17] = {bold = true, background = Screen.colors.Red}, + [18] = {background = Screen.colors.LightMagenta}, + }) + + insert([[ + 1 + + + 2 + 1a + ]]) + command("vnew") + insert([[ + 2 + 2a + 2b + ]]) + command("windo diffthis") + command("windo 1") + screen:expect{grid=[[ + {13: }{16:-------}{14:│}{13: }{15:^1 }| + {13: }{16:-------}{14:│}{13: }{15: }| + {13: }{16:-------}{14:│}{13: }{15: }| + {13: }2 {14:│}{13: }2 | + {13: }{17:2}{18:a }{14:│}{13: }{17:1}{18:a }| + {13: }{15:2b }{14:│}{13: }{16:------------------}| + {13: } {14:│}{13: } | + {1:~ }{14:│}{1:~ }| + {14:') + feed('') + feed('') + feed('') + feed('') + screen:expect{grid=[[ + {13: }{16:-------}{14:│}{13: }{15:1 }| + {13: }{16:-------}{14:│}{13: }{15: }| + {13: }{16:-------}{14:│}{13: }{15:^ }| + {13: }2 {14:│}{13: }2 | + {13: }{17:2}{18:a }{14:│}{13: }{17:1}{18:a }| + {13: }{15:2b }{14:│}{13: }{16:------------------}| + {13: } {14:│}{13: } | + {1:~ }{14:│}{1:~ }| + {14: Date: Sun, 22 Sep 2019 14:58:38 +0200 Subject: tests: make 'win_update redraws lines properly' more readable (#11068) --- test/functional/ui/diff_spec.lua | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 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 572ed5c695..252991aca7 100644 --- a/test/functional/ui/diff_spec.lua +++ b/test/functional/ui/diff_spec.lua @@ -963,7 +963,7 @@ end) it('win_update redraws lines properly', function() local screen clear() - screen = Screen.new(30, 10) + screen = Screen.new(50, 10) screen:attach() screen:set_default_attr_ids({ [1] = {bold = true, foreground = Screen.colors.Blue1}, @@ -993,7 +993,7 @@ it('win_update redraws lines properly', function() 2 1a ]]) - command("vnew") + command("vnew left") insert([[ 2 2a @@ -1002,16 +1002,16 @@ it('win_update redraws lines properly', function() command("windo diffthis") command("windo 1") screen:expect{grid=[[ - {13: }{16:-------}{14:│}{13: }{15:^1 }| - {13: }{16:-------}{14:│}{13: }{15: }| - {13: }{16:-------}{14:│}{13: }{15: }| - {13: }2 {14:│}{13: }2 | - {13: }{17:2}{18:a }{14:│}{13: }{17:1}{18:a }| - {13: }{15:2b }{14:│}{13: }{16:------------------}| - {13: } {14:│}{13: } | - {1:~ }{14:│}{1:~ }| - {14:') feed('') @@ -1019,15 +1019,15 @@ it('win_update redraws lines properly', function() feed('') feed('') screen:expect{grid=[[ - {13: }{16:-------}{14:│}{13: }{15:1 }| - {13: }{16:-------}{14:│}{13: }{15: }| - {13: }{16:-------}{14:│}{13: }{15:^ }| - {13: }2 {14:│}{13: }2 | - {13: }{17:2}{18:a }{14:│}{13: }{17:1}{18:a }| - {13: }{15:2b }{14:│}{13: }{16:------------------}| - {13: } {14:│}{13: } | - {1:~ }{14:│}{1:~ }| - {14: