aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/diff_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ui/diff_spec.lua')
-rw-r--r--test/functional/ui/diff_spec.lua151
1 files changed, 151 insertions, 0 deletions
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index 8eb2bbf779..69b6ab8cf0 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -3,7 +3,10 @@ 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
+local source = helpers.source
describe('Diff mode screen', function()
local fname = 'Xtest-functional-diff-screen-1'
@@ -957,3 +960,151 @@ int main(int argc, char **argv)
end)
end)
end)
+
+it('win_update redraws lines properly', function()
+ local screen
+ clear()
+ screen = Screen.new(50, 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 left")
+ 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:left [+] }{12:[No Name] [+] }|
+ |
+ ]]}
+ feed('<C-e>')
+ feed('<C-e>')
+ feed('<C-y>')
+ feed('<C-y>')
+ feed('<C-y>')
+ 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:left [+] }{12:[No Name] [+] }|
+ |
+ ]]}
+end)
+
+it('diff updates line numbers below filler lines', function()
+ clear()
+ 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},
+ })
+ source([[
+ call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
+ vnew
+ call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
+ windo diffthis
+ setlocal number rnu foldcolumn=0
+ ]])
+ screen:expect([[
+ {1: }a {3:│}{10:1 }^a |
+ {1: }a {3:│}{11: 1 }a |
+ {1: }a {3:│}{11: 2 }a |
+ {1: }{8:x}{9: }{3:│}{11: 3 }{8:y}{9: }|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }b {3:│}{11: 4 }b |
+ {1: }b {3:│}{11: 5 }b |
+ {1: }b {3:│}{11: 6 }b |
+ {1: }b {3:│}{11: 7 }b |
+ {1: }b {3:│}{11: 8 }b |
+ {6:~ }{3:│}{6:~ }|
+ {3:[No Name] [+] }{7:[No Name] [+] }|
+ |
+ ]])
+ feed('j')
+ screen:expect([[
+ {1: }a {3:│}{11: 1 }a |
+ {1: }a {3:│}{10:2 }^a |
+ {1: }a {3:│}{11: 1 }a |
+ {1: }{8:x}{9: }{3:│}{11: 2 }{8:y}{9: }|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }b {3:│}{11: 3 }b |
+ {1: }b {3:│}{11: 4 }b |
+ {1: }b {3:│}{11: 5 }b |
+ {1: }b {3:│}{11: 6 }b |
+ {1: }b {3:│}{11: 7 }b |
+ {6:~ }{3:│}{6:~ }|
+ {3:[No Name] [+] }{7:[No Name] [+] }|
+ |
+ ]])
+ feed('j')
+ screen:expect([[
+ {1: }a {3:│}{11: 2 }a |
+ {1: }a {3:│}{11: 1 }a |
+ {1: }a {3:│}{10:3 }^a |
+ {1: }{8:x}{9: }{3:│}{11: 1 }{8:y}{9: }|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }{4:x }{3:│}{11: }{2:----------------}|
+ {1: }b {3:│}{11: 2 }b |
+ {1: }b {3:│}{11: 3 }b |
+ {1: }b {3:│}{11: 4 }b |
+ {1: }b {3:│}{11: 5 }b |
+ {1: }b {3:│}{11: 6 }b |
+ {6:~ }{3:│}{6:~ }|
+ {3:[No Name] [+] }{7:[No Name] [+] }|
+ |
+ ]])
+end)