annotate src/testdir/test_diffmode.vim @ 29275:281509f1417b v8.2.5155

patch 8.2.5155: in diff mode windows may get out of sync Commit: https://github.com/vim/vim/commit/a315ce1f326b836167ca8b1037dafd93eb8d4d4e Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 24 12:38:57 2022 +0100 patch 8.2.5155: in diff mode windows may get out of sync Problem: In diff mode windows may get out of sync. (Gary Johnson) Solution: Avoid that the other window scrolls for 'cursorbind'.
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 Jun 2022 13:45:04 +0200
parents 27ae8ea82d7a
children bf4d7898cf93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for diff mode
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21321
diff changeset
2
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
3 source shared.vim
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
4 source screendump.vim
17614
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
5 source check.vim
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_diff_fold_sync()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 enew!
14770
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
9 let g:update_count = 0
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
10 au DiffUpdated * let g:update_count += 1
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
11
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 let l = range(50)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 let winone = win_getid()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 new
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 let l[25] = 'diff'
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 let wintwo = win_getid()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " line 15 is inside the closed fold
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal(19, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call win_gotoid(winone)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal(19, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " open the fold
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 normal zv
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(-1, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 " fold in other window must have opened too
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call win_gotoid(wintwo)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal(-1, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 " cursor position is in sync
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 normal 23G
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call win_gotoid(winone)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal(23, getcurpos()[1])
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
14770
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
37 call assert_equal(1, g:update_count)
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
38 au! DiffUpdated
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
39
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 windo diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 close!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 set nomodified
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 func Test_vert_split()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
46 set diffopt=filler
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
47 call Common_vert_split()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
48 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
49 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
50
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
51 func Test_vert_split_internal()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
52 set diffopt=internal,filler
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
53 call Common_vert_split()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
54 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
55 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
56
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
57 func Common_vert_split()
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 " Disable the title to avoid xterm keeping the wrong one.
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 set notitle noicon
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 new
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 let l = ['1 aa', '2 bb', '3 cc', '4 dd', '5 ee']
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 w! Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 normal dd
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 $
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 put
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 normal kkrXoxxx
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 w! Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 file Nop
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 normal ggoyyyjjjozzzz
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 set foldmethod=marker foldcolumn=4
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 vert diffsplit Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 vert diffsplit Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call assert_equal(1, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal('diff', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal(2, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call assert_equal(1, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call assert_equal(1, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal(0, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 let diff_fdm = &fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 let diff_fdc = &fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 " repeat entering diff mode here to see if this saves the wrong settings
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 " jump to second window for a moment to have filler line appear at start of
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 " first window
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 wincmd p
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 call assert_equal(9, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call assert_equal(1, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call assert_equal(3, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 call assert_equal(7, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 " Test diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 diffoff!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 1wincmd 2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 let &diff = 1
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 let &fdm = diff_fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 let &fdc = diff_fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 4wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 diffoff!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 1wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169
9696
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
170 call delete('Xtest')
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
171 call delete('Xtest2')
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 windo bw!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 func Test_filler_lines()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 " Test that diffing shows correct filler lines
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 enew!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 put =range(4,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 vnew
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 put =range(1,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 windo diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 wincmd h
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 call assert_equal(1, line('w0'))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 unlet! diff_fdm diff_fdc
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
187 windo diffoff
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
188 bwipe!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
189 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
190 endfunc
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
192 func Test_diffget_diffput()
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
193 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
194 let l = range(50)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
195 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
196 call assert_fails('diffget', 'E99:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
197 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
198 call assert_fails('diffget', 'E100:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
199 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
200 let l[10] = 'one'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
201 let l[20] = 'two'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
202 let l[30] = 'three'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
203 let l[40] = 'four'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
204 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
205 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
206 call assert_equal('one', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
207 11diffget
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
208 call assert_equal('10', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
209 21diffput
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
210 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
211 call assert_equal('two', getline(21))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
212 normal 31Gdo
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
213 call assert_equal('three', getline(31))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
214 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
215 normal 41Gdp
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
216 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
217 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
218 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
219 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
220 call assert_fails('diffget', 'E101:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
221
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
222 windo diffoff
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
223 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
224 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
225
14972
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
226 " Test putting two changes from one buffer to another
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
227 func Test_diffput_two()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
228 new a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
229 let win_a = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
230 call setline(1, range(1, 10))
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
231 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
232 new b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
233 let win_b = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
234 call setline(1, range(1, 10))
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
235 8del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
236 5del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
237 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
238 call win_gotoid(win_a)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
239 %diffput
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
240 call win_gotoid(win_b)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
241 call assert_equal(map(range(1, 10), 'string(v:val)'), getline(1, '$'))
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
242 bwipe! a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
243 bwipe! b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
244 endfunc
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
245
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
246 " Test for :diffget/:diffput with a range that is inside a diff chunk
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
247 func Test_diffget_diffput_range()
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
248 call setline(1, range(1, 10))
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
249 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
250 call setline(1, range(11, 20))
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
251 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
252 3,5diffget
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
253 call assert_equal(['13', '14', '15'], getline(3, 5))
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
254 call setline(1, range(1, 10))
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
255 4,8diffput
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
256 wincmd p
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
257 call assert_equal(['13', '4', '5', '6', '7', '8', '19'], getline(3, 9))
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
258 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
259 endfunc
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
260
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
261 " Test for :diffget/:diffput with an empty buffer and a non-empty buffer
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
262 func Test_diffget_diffput_empty_buffer()
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
263 %d _
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
264 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
265 call setline(1, 'one')
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
266 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
267 diffget
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
268 call assert_equal(['one'], getline(1, '$'))
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
269 %d _
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
270 diffput
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
271 wincmd p
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
272 call assert_equal([''], getline(1, '$'))
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
273 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
274 endfunc
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
275
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
276 " :diffput and :diffget completes names of buffers which
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26044
diff changeset
277 " are in diff mode and which are different than current buffer.
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
278 " No completion when the current window is not in diff mode.
18987
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
279 func Test_diffget_diffput_completion()
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
280 e Xdiff1 | diffthis
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
281 botright new Xdiff2
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
282 botright new Xdiff3 | split | diffthis
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
283 botright new Xdiff4 | diffthis
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
284
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
285 wincmd t
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
286 call assert_equal('Xdiff1', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
287 call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
288 call assert_equal('"diffput Xdiff3 Xdiff4', @:)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
289 call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
290 call assert_equal('"diffget Xdiff3 Xdiff4', @:)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
291 call assert_equal(['Xdiff3', 'Xdiff4'], getcompletion('', 'diff_buffer'))
18987
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
292
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
293 " Xdiff2 is not in diff mode, so no completion for :diffput, :diffget
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
294 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
295 call assert_equal('Xdiff2', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
296 call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
297 call assert_equal('"diffput ', @:)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
298 call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
299 call assert_equal('"diffget ', @:)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
300 call assert_equal([], getcompletion('', 'diff_buffer'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
301
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
302 " Xdiff3 is split in 2 windows, only the top one is in diff mode.
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
303 " So completion of :diffput :diffget only happens in the top window.
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
304 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
305 call assert_equal('Xdiff3', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
306 call assert_equal(1, &diff)
18987
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
307 call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
308 call assert_equal('"diffput Xdiff1 Xdiff4', @:)
18987
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
309 call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
310 call assert_equal('"diffget Xdiff1 Xdiff4', @:)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
311 call assert_equal(['Xdiff1', 'Xdiff4'], getcompletion('', 'diff_buffer'))
18987
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
312
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
313 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
314 call assert_equal('Xdiff3', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
315 call assert_equal(0, &diff)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
316 call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
317 call assert_equal('"diffput ', @:)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
318 call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
319 call assert_equal('"diffget ', @:)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
320 call assert_equal([], getcompletion('', 'diff_buffer'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
321
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
322 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
323 call assert_equal('Xdiff4', bufname('%'))
18987
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
324 call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
325 call assert_equal('"diffput Xdiff1 Xdiff3', @:)
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
326 call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
327 call assert_equal('"diffget Xdiff1 Xdiff3', @:)
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
328 call assert_equal(['Xdiff1', 'Xdiff3'], getcompletion('', 'diff_buffer'))
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
329
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
330 %bwipe
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
331 endfunc
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
332
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
333 func Test_dp_do_buffer()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
334 e! one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
335 let bn1=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
336 let l = range(60)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
337 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
338 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
339
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
340 new two
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
341 let l[10] = 'one'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
342 let l[20] = 'two'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
343 let l[30] = 'three'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
344 let l[40] = 'four'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
345 let l[50] = 'five'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
346 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
347 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
348
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
349 " dp and do with invalid buffer number.
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
350 11
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
351 call assert_fails('norm 99999dp', 'E102:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
352 call assert_fails('norm 99999do', 'E102:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
353 call assert_fails('diffput non_existing_buffer', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
354 call assert_fails('diffget non_existing_buffer', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
355
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
356 " dp and do with valid buffer number.
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
357 call assert_equal('one', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
358 exe 'norm ' . bn1 . 'do'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
359 call assert_equal('10', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
360 21
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
361 call assert_equal('two', getline('.'))
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
362 diffget one
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
363 call assert_equal('20', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
364
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
365 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
366 exe 'norm ' . bn1 . 'dp'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
367 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
368 diffput one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
369 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
370 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
371 call assert_equal('three', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
372 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
373 call assert_equal('four', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
374
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
375 " dp and do with buffer number which is not in diff mode.
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
376 new not_in_diff_mode
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
377 let bn3=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
378 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
379 51
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
380 call assert_fails('exe "norm" . bn3 . "dp"', 'E103:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
381 call assert_fails('exe "norm" . bn3 . "do"', 'E103:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
382 call assert_fails('diffput not_in_diff_mode', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
383 call assert_fails('diffget not_in_diff_mode', 'E94:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
384
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
385 windo diffoff
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
386 %bwipe!
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387 endfunc
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
388
14893
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
389 func Test_do_lastline()
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
390 e! one
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
391 call setline(1, ['1','2','3','4','5','6'])
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
392 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
393
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
394 new two
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
395 call setline(1, ['2','4','5'])
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
396 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
397
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
398 1
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
399 norm dp]c
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
400 norm dp]c
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
401 wincmd w
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
402 call assert_equal(4, line('$'))
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
403 norm G
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
404 norm do
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
405 call assert_equal(3, line('$'))
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
406
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
407 windo diffoff
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
408 %bwipe!
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
409 endfunc
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
410
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
411 func Test_diffoff()
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
412 enew!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
413 call setline(1, ['Two', 'Three'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
414 redraw
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
415 let normattr = screenattr(1, 1)
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
416 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
417 botright vert new
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
418 call setline(1, ['One', '', 'Two', 'Three'])
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
419 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
420 redraw
17994
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
421 call assert_notequal(normattr, 1->screenattr(1))
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
422 diffoff!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
423 redraw
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
424 call assert_equal(normattr, screenattr(1, 1))
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
425 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
426 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
427 endfunc
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
428
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
429 func Common_icase_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
430 edit one
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
431 call setline(1, ['One', 'Two', 'Three', 'Four', 'Fi#ve'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
432 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
433 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
434 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
435
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
436 botright vert new two
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
437 call setline(1, ['one', 'TWO', 'Three ', 'Four', 'fI=VE'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
438 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
439
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
440 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
441 call assert_equal(normattr, screenattr(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
442 call assert_equal(normattr, screenattr(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
443 call assert_notequal(normattr, screenattr(3, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
444 call assert_equal(normattr, screenattr(4, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
445
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
446 let dtextattr = screenattr(5, 3)
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
447 call assert_notequal(dtextattr, screenattr(5, 1))
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
448 call assert_notequal(dtextattr, screenattr(5, 5))
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
449
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
450 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
451 %bwipe!
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
452 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
453
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
454 func Test_diffopt_icase()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
455 set diffopt=icase,foldcolumn:0
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
456 call Common_icase_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
457 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
458 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
459
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
460 func Test_diffopt_icase_internal()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
461 set diffopt=icase,foldcolumn:0,internal
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
462 call Common_icase_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
463 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
464 endfunc
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
465
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
466 func Common_iwhite_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
467 edit one
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
468 " Difference in trailing spaces and amount of spaces should be ignored,
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
469 " but not other space differences.
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
470 call setline(1, ["One \t", 'Two', 'Three', 'one two', 'one two', 'Four'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
471 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
472 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
473 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
474
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
475 botright vert new two
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
476 call setline(1, ["One\t ", "Two\t ", 'Three', 'one two', 'onetwo', ' Four'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
477 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
478
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
479 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
480 call assert_equal(normattr, screenattr(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
481 call assert_equal(normattr, screenattr(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
482 call assert_equal(normattr, screenattr(3, 1))
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
483 call assert_equal(normattr, screenattr(4, 1))
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
484 call assert_notequal(normattr, screenattr(5, 1))
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
485 call assert_notequal(normattr, screenattr(6, 1))
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
486
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
487 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
488 %bwipe!
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
489 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
490
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
491 func Test_diffopt_iwhite()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
492 set diffopt=iwhite,foldcolumn:0
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
493 call Common_iwhite_test()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
494 set diffopt&
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
495 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
496
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
497 func Test_diffopt_iwhite_internal()
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
498 set diffopt=internal,iwhite,foldcolumn:0
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
499 call Common_iwhite_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
500 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
501 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
502
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
503 func Test_diffopt_context()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
504 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
505 call setline(1, ['1', '2', '3', '4', '5', '6', '7'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
506 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
507 new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
508 call setline(1, ['1', '2', '3', '4', '5x', '6', '7'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
509 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
510
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
511 set diffopt=context:2
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
512 call assert_equal('+-- 2 lines: 1', foldtextresult(1))
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
513 set diffopt=internal,context:2
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
514 call assert_equal('+-- 2 lines: 1', foldtextresult(1))
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
515
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
516 set diffopt=context:1
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
517 call assert_equal('+-- 3 lines: 1', foldtextresult(1))
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
518 set diffopt=internal,context:1
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
519 call assert_equal('+-- 3 lines: 1', foldtextresult(1))
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
520
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
521 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
522 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
523 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
524 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
525
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
526 func Test_diffopt_horizontal()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
527 set diffopt=internal,horizontal
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
528 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
529
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
530 call assert_equal(&columns, winwidth(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
531 call assert_equal(&columns, winwidth(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
532 call assert_equal(&lines, winheight(1) + winheight(2) + 3)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
533 call assert_inrange(0, 1, winheight(1) - winheight(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
534
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
535 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
536 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
537 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
538 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
539
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
540 func Test_diffopt_vertical()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
541 set diffopt=internal,vertical
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
542 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
543
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
544 call assert_equal(&lines - 2, winheight(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
545 call assert_equal(&lines - 2, winheight(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
546 call assert_equal(&columns, winwidth(1) + winwidth(2) + 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
547 call assert_inrange(0, 1, winwidth(1) - winwidth(2))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
548
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
549 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
550 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
551 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
552 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
553
12971
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
554 func Test_diffopt_hiddenoff()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
555 set diffopt=internal,filler,foldcolumn:0,hiddenoff
12971
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
556 e! one
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
557 call setline(1, ['Two', 'Three'])
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
558 redraw
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
559 let normattr = screenattr(1, 1)
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
560 diffthis
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
561 botright vert new two
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
562 call setline(1, ['One', 'Four'])
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
563 diffthis
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
564 redraw
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
565 call assert_notequal(normattr, screenattr(1, 1))
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
566 set hidden
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
567 close
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
568 redraw
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
569 " should not diffing with hidden buffer two while 'hiddenoff' is enabled
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
570 call assert_equal(normattr, screenattr(1, 1))
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
571
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
572 bwipe!
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
573 bwipe!
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
574 set hidden& diffopt&
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
575 endfunc
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
576
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
577 func Test_diffoff_hidden()
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
578 set diffopt=internal,filler,foldcolumn:0
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
579 e! one
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
580 call setline(1, ['Two', 'Three'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
581 redraw
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
582 let normattr = screenattr(1, 1)
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
583 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
584 botright vert new two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
585 call setline(1, ['One', 'Four'])
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
586 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
587 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
588 call assert_notequal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
589 set hidden
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
590 close
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
591 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
592 " diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
593 call assert_notequal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
594 diffoff
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
595 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
596 call assert_equal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
597 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
598 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
599 " still diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
600 call assert_notequal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
601 diffoff!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
602 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
603 call assert_equal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
604 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
605 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
606 " no longer diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
607 call assert_equal(normattr, screenattr(1, 1))
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
608
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
609 bwipe!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
610 bwipe!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
611 set hidden& diffopt&
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
612 endfunc
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
613
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
614 func Test_setting_cursor()
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
615 new Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
616 put =range(1,90)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
617 wq
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
618 new Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
619 put =range(1,100)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
620 wq
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
621
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
622 tabe Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
623 $
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
624 diffsp Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
625 tabclose
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
626
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
627 call delete('Xtest1')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
628 call delete('Xtest2')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
629 endfunc
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
630
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
631 func Test_diff_move_to()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
632 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
633 call setline(1, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
634 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
635 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
636 call setline(1, [1, '2x', 3, 4, 4, 5, '6x', 7, '8x', 9, '10x'])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
637 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
638 norm ]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
639 call assert_equal(2, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
640 norm 3]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
641 call assert_equal(9, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
642 norm 10]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
643 call assert_equal(11, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
644 norm [c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
645 call assert_equal(9, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
646 norm 2[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
647 call assert_equal(5, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
648 norm 10[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
649 call assert_equal(2, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
650 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
651 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
652
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
653 func Test_diffexpr()
23027
f74978697fb6 patch 8.2.2060: check for features implemented with "if"
Bram Moolenaar <Bram@vim.org>
parents: 22818
diff changeset
654 CheckExecutable diff
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
655
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
656 func DiffExpr()
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
657 " Prepend some text to check diff type detection
14726
655f00c29c58 patch 8.1.0375: cannot use diff mode with Cygwin diff.exe
Christian Brabandt <cb@256bit.org>
parents: 14696
diff changeset
658 call writefile(['warning', ' message'], v:fname_out)
655f00c29c58 patch 8.1.0375: cannot use diff mode with Cygwin diff.exe
Christian Brabandt <cb@256bit.org>
parents: 14696
diff changeset
659 silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
660 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
661 set diffexpr=DiffExpr()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
662 set diffopt=foldcolumn:0
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
663
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
664 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
665 call setline(1, ['one', 'two', 'three'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
666 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
667 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
668 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
669
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
670 botright vert new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
671 call setline(1, ['one', 'two', 'three.'])
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
672 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
673
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
674 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
675 call assert_equal(normattr, screenattr(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
676 call assert_equal(normattr, screenattr(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
677 call assert_notequal(normattr, screenattr(3, 1))
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
678 diffoff!
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
679
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26044
diff changeset
680 " Try using a non-existing function for 'diffexpr'.
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
681 set diffexpr=NewDiffFunc()
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
682 call assert_fails('windo diffthis', ['E117:', 'E97:'])
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
683 diffoff!
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
684
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
685 " Using a script-local function
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
686 func s:NewDiffExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
687 endfunc
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
688 set diffexpr=s:NewDiffExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
689 call assert_equal(expand('<SID>') .. 'NewDiffExpr()', &diffexpr)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
690 set diffexpr=<SID>NewDiffExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
691 call assert_equal(expand('<SID>') .. 'NewDiffExpr()', &diffexpr)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
692
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
693 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
694 set diffexpr& diffopt&
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
695 delfunc DiffExpr
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
696 delfunc s:NewDiffExpr
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
697 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
698
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
699 func Test_diffpatch()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
700 " The patch program on MS-Windows may fail or hang.
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21321
diff changeset
701 CheckExecutable patch
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21321
diff changeset
702 CheckUnix
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
703 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
704 insert
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
705 ***************
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
706 *** 1,3 ****
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
707 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
708 ! 2
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
709 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
710 --- 1,4 ----
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
711 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
712 ! 2x
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
713 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
714 + 4
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
715 .
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
716 saveas! Xpatch
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
717 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
718 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
719 call assert_fails('diffpatch Xpatch', 'E816:')
11109
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
720
11113
081ed9efb5c0 patch 8.0.0444: diffpatch fails when the file name has a quote
Christian Brabandt <cb@256bit.org>
parents: 11109
diff changeset
721 for name in ['Xpatch', 'Xpatch$HOME', 'Xpa''tch']
11109
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
722 call setline(1, ['1', '2', '3'])
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
723 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
724 call rename('Xpatch', name)
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
725 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
726 exe 'diffpatch ' . escape(name, '$')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
727 call assert_equal(['1', '2x', '3', '4'], getline(1, '$'))
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
728 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
729 call rename(name, 'Xpatch')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
730 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
731 bwipe!
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
732 endfor
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
733
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
734 call delete('Xpatch')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
735 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
736 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
737
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
738 func Test_diff_too_many_buffers()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
739 for i in range(1, 8)
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
740 exe "new Xtest" . i
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
741 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
742 endfor
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
743 new Xtest9
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
744 call assert_fails('diffthis', 'E96:')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
745 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
746 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
747
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
748 func Test_diff_nomodifiable()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
749 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
750 call setline(1, [1, 2, 3, 4])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
751 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
752 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
753 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
754 call setline(1, ['1x', 2, 3, 3, 4])
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
755 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
756 call assert_fails('norm dp', 'E793:')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
757 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
758 call assert_fails('norm do', 'E21:')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
759 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
760 endfunc
11065
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
761
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
762 func Test_diff_hlID()
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
763 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
764 call setline(1, [1, 2, 3])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
765 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
766 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
767 call setline(1, ['1x', 2, 'x', 3])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
768 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
769 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
770
17624
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
771 call diff_hlID(-1, 1)->synIDattr("name")->assert_equal("")
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
772
17624
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
773 call diff_hlID(1, 1)->synIDattr("name")->assert_equal("DiffChange")
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
774 call diff_hlID(1, 2)->synIDattr("name")->assert_equal("DiffText")
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
775 call diff_hlID(2, 1)->synIDattr("name")->assert_equal("")
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
776 call diff_hlID(3, 1)->synIDattr("name")->assert_equal("DiffAdd")
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17624
diff changeset
777 eval 4->diff_hlID(1)->synIDattr("name")->assert_equal("")
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
778
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
779 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
780 call assert_equal(synIDattr(diff_hlID(1, 1), "name"), "DiffChange")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
781 call assert_equal(synIDattr(diff_hlID(2, 1), "name"), "")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
782 call assert_equal(synIDattr(diff_hlID(3, 1), "name"), "")
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
783
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
784 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
785 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
786
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
787 func Test_diff_filler()
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
788 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
789 call setline(1, [1, 2, 3, 'x', 4])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
790 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
791 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
792 call setline(1, [1, 2, 'y', 'y', 3, 4])
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
793 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
794 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
795
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17624
diff changeset
796 call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'v:val->diff_filler()'))
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
797 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
798 call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)'))
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
799
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
800 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
801 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
802
11065
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
803 func Test_diff_lastline()
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
804 enew!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
805 only!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
806 call setline(1, ['This is a ', 'line with five ', 'rows'])
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
807 diffthis
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
808 botright vert new
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
809 call setline(1, ['This is', 'a line with ', 'four rows'])
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
810 diffthis
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
811 1
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
812 call feedkeys("Je a\<CR>", 'tx')
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
813 call feedkeys("Je a\<CR>", 'tx')
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
814 let w1lines = winline()
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
815 wincmd w
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
816 $
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
817 let w2lines = winline()
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
818 call assert_equal(w2lines, w1lines)
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
819 bwipe!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
820 bwipe!
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
821 endfunc
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
822
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
823 func WriteDiffFiles(buf, list1, list2)
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
824 call writefile(a:list1, 'Xfile1')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
825 call writefile(a:list2, 'Xfile2')
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
826 if a:buf
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
827 call term_sendkeys(a:buf, ":checktime\<CR>")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
828 endif
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
829 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
830
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
831 " Verify a screendump with both the internal and external diff.
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
832 func VerifyBoth(buf, dumpfile, extra)
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
833 " trailing : for leaving the cursor on the command line
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
834 for cmd in [":set diffopt=filler" . a:extra . "\<CR>:", ":set diffopt+=internal\<CR>:"]
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
835 call term_sendkeys(a:buf, cmd)
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
836 if VerifyScreenDump(a:buf, a:dumpfile, {}, cmd =~ 'internal' ? 'internal' : 'external')
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
837 " don't let the next iteration overwrite the "failed" file.
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
838 return
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
839 endif
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
840 endfor
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
841
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
842 " also test unified diff
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
843 call term_sendkeys(a:buf, ":call SetupUnified()\<CR>:")
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
844 call term_sendkeys(a:buf, ":redraw!\<CR>:")
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
845 call VerifyScreenDump(a:buf, a:dumpfile, {}, 'unified')
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
846 call term_sendkeys(a:buf, ":call StopUnified()\<CR>:")
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
847 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
848
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
849 " Verify a screendump with the internal diff only.
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
850 func VerifyInternal(buf, dumpfile, extra)
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
851 call term_sendkeys(a:buf, ":diffupdate!\<CR>")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
852 " trailing : for leaving the cursor on the command line
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
853 call term_sendkeys(a:buf, ":set diffopt=internal,filler" . a:extra . "\<CR>:")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
854 call VerifyScreenDump(a:buf, a:dumpfile, {})
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
855 endfunc
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
856
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
857 func Test_diff_screen()
25969
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 25717
diff changeset
858 let g:test_is_flaky = 1
17614
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
859 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
860 CheckFeature menu
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
861
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
862 let lines =<< trim END
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
863 func UnifiedDiffExpr()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
864 " Prepend some text to check diff type detection
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
865 call writefile(['warning', ' message'], v:fname_out)
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
866 silent exe '!diff -U0 ' .. v:fname_in .. ' ' .. v:fname_new .. '>>' .. v:fname_out
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
867 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
868 func SetupUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
869 set diffexpr=UnifiedDiffExpr()
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
870 diffupdate
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
871 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
872 func StopUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
873 set diffexpr=
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
874 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
875 END
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
876 call writefile(lines, 'XdiffSetup')
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
877
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
878 " clean up already existing swap files, just in case
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
879 call delete('.Xfile1.swp')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
880 call delete('.Xfile2.swp')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
881
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
882 " Test 1: Add a line in beginning of file 2
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
883 call WriteDiffFiles(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
884 let buf = RunVimInTerminal('-d -S XdiffSetup Xfile1 Xfile2', {})
16135
dc0801e374e0 patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15900
diff changeset
885 " Set autoread mode, so that Vim won't complain once we re-write the test
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
886 " files
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
887 call term_sendkeys(buf, ":set autoread\<CR>\<c-w>w:set autoread\<CR>\<c-w>w")
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
888
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
889 call VerifyBoth(buf, 'Test_diff_01', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
890
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
891 " Test 2: Add a line in beginning of file 1
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
892 call WriteDiffFiles(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
893 call VerifyBoth(buf, 'Test_diff_02', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
894
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
895 " Test 3: Add a line at the end of file 2
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
896 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
897 call VerifyBoth(buf, 'Test_diff_03', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
898
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
899 " Test 4: Add a line at the end of file 1
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
900 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
901 call VerifyBoth(buf, 'Test_diff_04', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
902
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
903 " Test 5: Add a line in the middle of file 2, remove on at the end of file 1
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
904 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
905 call VerifyBoth(buf, 'Test_diff_05', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
906
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
907 " Test 6: Add a line in the middle of file 1, remove on at the end of file 2
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
908 call WriteDiffFiles(buf, [1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
909 call VerifyBoth(buf, 'Test_diff_06', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
910
15900
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
911 " Variants on test 6 with different context settings
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
912 call term_sendkeys(buf, ":set diffopt+=context:2\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
913 call VerifyScreenDump(buf, 'Test_diff_06.2', {})
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
914 call term_sendkeys(buf, ":set diffopt-=context:2\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
915 call term_sendkeys(buf, ":set diffopt+=context:1\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
916 call VerifyScreenDump(buf, 'Test_diff_06.1', {})
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
917 call term_sendkeys(buf, ":set diffopt-=context:1\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
918 call term_sendkeys(buf, ":set diffopt+=context:0\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
919 call VerifyScreenDump(buf, 'Test_diff_06.0', {})
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
920 call term_sendkeys(buf, ":set diffopt-=context:0\<cr>")
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
921
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
922 " Test 7 - 9: Test normal/patience/histogram diff algorithm
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
923 call WriteDiffFiles(buf, ['#include <stdio.h>', '', '// Frobs foo heartily', 'int frobnitz(int foo)', '{',
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
924 \ ' int i;', ' for(i = 0; i < 10; i++)', ' {', ' printf("Your answer is: ");',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
925 \ ' printf("%d\n", foo);', ' }', '}', '', 'int fact(int n)', '{', ' if(n > 1)', ' {',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
926 \ ' return fact(n-1) * n;', ' }', ' return 1;', '}', '', 'int main(int argc, char **argv)',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
927 \ '{', ' frobnitz(fact(10));', '}'],
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
928 \ ['#include <stdio.h>', '', 'int fib(int n)', '{', ' if(n > 2)', ' {',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
929 \ ' return fib(n-1) + fib(n-2);', ' }', ' return 1;', '}', '', '// Frobs foo heartily',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
930 \ 'int frobnitz(int foo)', '{', ' int i;', ' for(i = 0; i < 10; i++)', ' {',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
931 \ ' printf("%d\n", foo);', ' }', '}', '',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
932 \ 'int main(int argc, char **argv)', '{', ' frobnitz(fib(10));', '}'])
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
933 call term_sendkeys(buf, ":diffupdate!\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
934 call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
935 call VerifyScreenDump(buf, 'Test_diff_07', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
936
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
937 call term_sendkeys(buf, ":set diffopt+=algorithm:patience\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
938 call VerifyScreenDump(buf, 'Test_diff_08', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
939
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
940 call term_sendkeys(buf, ":set diffopt+=algorithm:histogram\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
941 call VerifyScreenDump(buf, 'Test_diff_09', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
942
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
943 " Test 10-11: normal/indent-heuristic
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
944 call term_sendkeys(buf, ":set diffopt&vim\<cr>")
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
945 call WriteDiffFiles(buf, ['', ' def finalize(values)', '', ' values.each do |v|', ' v.finalize', ' end'],
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
946 \ ['', ' def finalize(values)', '', ' values.each do |v|', ' v.prepare', ' end', '',
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
947 \ ' values.each do |v|', ' v.finalize', ' end'])
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
948 call term_sendkeys(buf, ":diffupdate!\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
949 call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
950 call VerifyScreenDump(buf, 'Test_diff_10', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
951
15103
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
952 " Leave trailing : at commandline!
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
953 call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>:\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
954 call VerifyScreenDump(buf, 'Test_diff_11', {}, 'one')
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
955 " shouldn't matter, if indent-algorithm comes before or after the algorithm
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
956 call term_sendkeys(buf, ":set diffopt&\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
957 call term_sendkeys(buf, ":set diffopt+=indent-heuristic,algorithm:patience\<cr>:\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
958 call VerifyScreenDump(buf, 'Test_diff_11', {}, 'two')
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
959 call term_sendkeys(buf, ":set diffopt&\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
960 call term_sendkeys(buf, ":set diffopt+=algorithm:patience,indent-heuristic\<cr>:\<cr>")
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
961 call VerifyScreenDump(buf, 'Test_diff_11', {}, 'three')
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
962
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
963 " Test 12: diff the same file
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
964 call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
965 call VerifyBoth(buf, 'Test_diff_12', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
966
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
967 " Test 13: diff an empty file
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
968 call WriteDiffFiles(buf, [], [])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
969 call VerifyBoth(buf, 'Test_diff_13', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
970
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
971 " Test 14: test diffopt+=icase
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
972 call WriteDiffFiles(buf, ['a', 'b', 'cd'], ['A', 'b', 'cDe'])
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
973 call VerifyBoth(buf, 'Test_diff_14', " diffopt+=filler diffopt+=icase")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
974
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
975 " Test 15-16: test diffopt+=iwhite
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
976 call WriteDiffFiles(buf, ['int main()', '{', ' printf("Hello, World!");', ' return 0;', '}'],
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
977 \ ['int main()', '{', ' if (0)', ' {', ' printf("Hello, World!");', ' return 0;', ' }', '}'])
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
978 call term_sendkeys(buf, ":diffupdate!\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
979 call term_sendkeys(buf, ":set diffopt&vim diffopt+=filler diffopt+=iwhite\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
980 call VerifyScreenDump(buf, 'Test_diff_15', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
981 call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
982 call VerifyScreenDump(buf, 'Test_diff_16', {})
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
983
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
984 " Test 17: test diffopt+=iblank
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
985 call WriteDiffFiles(buf, ['a', ' ', 'cd', 'ef', 'xxx'], ['a', 'cd', '', 'ef', 'yyy'])
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
986 call VerifyInternal(buf, 'Test_diff_17', " diffopt+=iblank")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
987
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
988 " Test 18: test diffopt+=iblank,iwhite / iwhiteall / iwhiteeol
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
989 call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhite")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
990 call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteall")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
991 call VerifyInternal(buf, 'Test_diff_18', " diffopt+=iblank,iwhiteeol")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
992
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
993 " Test 19: test diffopt+=iwhiteeol
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
994 call WriteDiffFiles(buf, ['a ', 'x', 'cd', 'ef', 'xx xx', 'foo', 'bar'], ['a', 'x', 'c d', ' ef', 'xx xx', 'foo', '', 'bar'])
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
995 call VerifyInternal(buf, 'Test_diff_19', " diffopt+=iwhiteeol")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
996
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
997 " Test 19: test diffopt+=iwhiteall
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
998 call VerifyInternal(buf, 'Test_diff_20', " diffopt+=iwhiteall")
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
999
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1000 " clean up
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1001 call StopVimInTerminal(buf)
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1002 call delete('Xfile1')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1003 call delete('Xfile2')
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
1004 call delete('XdiffSetup')
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1005 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1006
25717
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1007 func Test_diff_with_scroll_and_change()
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1008 CheckScreendump
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1009
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1010 let lines =<< trim END
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1011 call setline(1, range(1, 15))
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1012 vnew
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1013 call setline(1, range(9, 15))
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1014 windo diffthis
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1015 wincmd h
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1016 exe "normal Gl5\<C-E>"
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1017 END
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1018 call writefile(lines, 'Xtest_scroll_change')
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1019 let buf = RunVimInTerminal('-S Xtest_scroll_change', {})
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1020
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1021 call VerifyScreenDump(buf, 'Test_diff_scroll_change_01', {})
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1022
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1023 call term_sendkeys(buf, "ax\<Esc>")
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1024 call VerifyScreenDump(buf, 'Test_diff_scroll_change_02', {})
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1025
26044
2e8226c03007 patch 8.2.3556: filler lines are incorrect for other window in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
1026 call term_sendkeys(buf, "\<C-W>lay\<Esc>")
2e8226c03007 patch 8.2.3556: filler lines are incorrect for other window in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
1027 call VerifyScreenDump(buf, 'Test_diff_scroll_change_03', {})
2e8226c03007 patch 8.2.3556: filler lines are incorrect for other window in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
1028
25717
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1029 " clean up
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1030 call StopVimInTerminal(buf)
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1031 call delete('Xtest_scroll_change')
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1032 endfunc
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1033
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1034 func Test_diff_with_cursorline()
17614
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
1035 CheckScreendump
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1036
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1037 call writefile([
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1038 \ 'hi CursorLine ctermbg=red ctermfg=white',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1039 \ 'set cursorline',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1040 \ 'call setline(1, ["foo","foo","foo","bar"])',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1041 \ 'vnew',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1042 \ 'call setline(1, ["bee","foo","foo","baz"])',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1043 \ 'windo diffthis',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1044 \ '2wincmd w',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1045 \ ], 'Xtest_diff_cursorline')
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1046 let buf = RunVimInTerminal('-S Xtest_diff_cursorline', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1047
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1048 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_01', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1049 call term_sendkeys(buf, "j")
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1050 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_02', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1051 call term_sendkeys(buf, "j")
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1052 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_03', {})
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1053
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1054 " clean up
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1055 call StopVimInTerminal(buf)
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1056 call delete('Xtest_diff_cursorline')
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1057 endfunc
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1058
27990
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1059 func Test_diff_with_cursorline_number()
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1060 CheckScreendump
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1061
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1062 let lines =<< trim END
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1063 hi CursorLine ctermbg=red ctermfg=white
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1064 hi CursorLineNr ctermbg=white ctermfg=black cterm=underline
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1065 set cursorline number
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1066 call setline(1, ["baz", "foo", "foo", "bar"])
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1067 2
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1068 vnew
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1069 call setline(1, ["foo", "foo", "bar"])
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1070 windo diffthis
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1071 1wincmd w
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1072 END
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1073 call writefile(lines, 'Xtest_diff_cursorline_number')
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1074 let buf = RunVimInTerminal('-S Xtest_diff_cursorline_number', {})
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1075
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1076 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_number_01', {})
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1077 call term_sendkeys(buf, ":set cursorlineopt=number\r")
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1078 call VerifyScreenDump(buf, 'Test_diff_with_cursorline_number_02', {})
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1079
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1080 " clean up
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1081 call StopVimInTerminal(buf)
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1082 call delete('Xtest_diff_cursorline_number')
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1083 endfunc
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1084
25517
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1085 func Test_diff_with_cursorline_breakindent()
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1086 CheckScreendump
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1087
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1088 call writefile([
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1089 \ 'hi CursorLine ctermbg=red ctermfg=white',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1090 \ 'set noequalalways wrap diffopt=followwrap cursorline breakindent',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1091 \ '50vnew',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1092 \ 'call setline(1, [" "," "," "," "])',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1093 \ 'exe "norm 20Afoo\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abar\<Esc>"',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1094 \ 'vnew',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1095 \ 'call setline(1, [" "," "," "," "])',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1096 \ 'exe "norm 20Abee\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abaz\<Esc>"',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1097 \ 'windo diffthis',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1098 \ '2wincmd w',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1099 \ ], 'Xtest_diff_cursorline_breakindent')
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1100 let buf = RunVimInTerminal('-S Xtest_diff_cursorline_breakindent', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1101
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1102 call term_sendkeys(buf, "gg0")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1103 call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_01', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1104 call term_sendkeys(buf, "j")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1105 call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_02', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1106 call term_sendkeys(buf, "j")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1107 call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_03', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1108 call term_sendkeys(buf, "j")
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1109 call VerifyScreenDump(buf, 'Test_diff_with_cul_bri_04', {})
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1110
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1111 " clean up
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1112 call StopVimInTerminal(buf)
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1113 call delete('Xtest_diff_cursorline_breakindent')
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1114 endfunc
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1115
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1116 func Test_diff_with_syntax()
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1117 CheckScreendump
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1118
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1119 let lines =<< trim END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1120 void doNothing() {
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1121 int x = 0;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1122 char *s = "hello";
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1123 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1124 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1125 END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1126 call writefile(lines, 'Xprogram1.c')
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1127 let lines =<< trim END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1128 void doSomething() {
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1129 int x = 0;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1130 char *s = "there";
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1131 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1132 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1133 END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1134 call writefile(lines, 'Xprogram2.c')
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1135
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1136 let lines =<< trim END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1137 edit Xprogram1.c
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1138 diffsplit Xprogram2.c
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1139 END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1140 call writefile(lines, 'Xtest_diff_syntax')
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1141 let buf = RunVimInTerminal('-S Xtest_diff_syntax', {})
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1142
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1143 call VerifyScreenDump(buf, 'Test_diff_syntax_1', {})
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1144
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1145 " clean up
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1146 call StopVimInTerminal(buf)
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1147 call delete('Xtest_diff_syntax')
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1148 call delete('Xprogram1.c')
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1149 call delete('Xprogram2.c')
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1150 endfunc
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1151
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1152 func Test_diff_of_diff()
17614
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
1153 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
1154 CheckFeature rightleft
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1155
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1156 call writefile([
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1157 \ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1158 \ 'vnew',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1159 \ 'call setline(1, ["aa","bb","cc"])',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1160 \ 'windo diffthis',
16135
dc0801e374e0 patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15900
diff changeset
1161 \ '1wincmd w',
dc0801e374e0 patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15900
diff changeset
1162 \ 'setlocal number',
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1163 \ ], 'Xtest_diff_diff')
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1164 let buf = RunVimInTerminal('-S Xtest_diff_diff', {})
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1165
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1166 call VerifyScreenDump(buf, 'Test_diff_of_diff_01', {})
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1167
16137
5a2033905f19 patch 8.1.1073: space in number column is on wrong side with 'rightleft' set
Bram Moolenaar <Bram@vim.org>
parents: 16135
diff changeset
1168 call term_sendkeys(buf, ":set rightleft\<cr>")
5a2033905f19 patch 8.1.1073: space in number column is on wrong side with 'rightleft' set
Bram Moolenaar <Bram@vim.org>
parents: 16135
diff changeset
1169 call VerifyScreenDump(buf, 'Test_diff_of_diff_02', {})
5a2033905f19 patch 8.1.1073: space in number column is on wrong side with 'rightleft' set
Bram Moolenaar <Bram@vim.org>
parents: 16135
diff changeset
1170
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1171 " clean up
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1172 call StopVimInTerminal(buf)
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1173 call delete('Xtest_diff_diff')
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1174 endfunc
18590
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1175
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1176 func CloseoffSetup()
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1177 enew
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1178 call setline(1, ['one', 'two', 'three'])
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1179 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1180 new
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1181 call setline(1, ['one', 'tow', 'three'])
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1182 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1183 call assert_equal(1, &diff)
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1184 only!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1185 endfunc
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1186
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1187 func Test_diff_closeoff()
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1188 " "closeoff" included by default: last diff win gets 'diff' reset'
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1189 call CloseoffSetup()
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1190 call assert_equal(0, &diff)
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1191 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1192
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1193 " "closeoff" excluded: last diff win keeps 'diff' set'
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1194 set diffopt-=closeoff
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1195 call CloseoffSetup()
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1196 call assert_equal(1, &diff)
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1197 diffoff!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1198 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1199 endfunc
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1200
23895
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1201 func Test_diff_followwrap()
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1202 new
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1203 set diffopt+=followwrap
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1204 set wrap
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1205 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1206 call assert_equal(1, &wrap)
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1207 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1208 set nowrap
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1209 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1210 call assert_equal(0, &wrap)
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1211 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1212 set diffopt&
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1213 bwipe!
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1214 endfunc
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1215
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1216 func Test_diff_maintains_change_mark()
26815
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1217 func DiffMaintainsChangeMark()
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1218 enew!
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1219 call setline(1, ['a', 'b', 'c', 'd'])
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1220 diffthis
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1221 new
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1222 call setline(1, ['a', 'b', 'c', 'e'])
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1223 " Set '[ and '] marks
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1224 2,3yank
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1225 call assert_equal([2, 3], [line("'["), line("']")])
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1226 " Verify they aren't affected by the implicit diff
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1227 diffthis
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1228 call assert_equal([2, 3], [line("'["), line("']")])
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1229 " Verify they aren't affected by an explicit diff
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1230 diffupdate
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1231 call assert_equal([2, 3], [line("'["), line("']")])
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1232 bwipe!
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1233 bwipe!
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1234 endfunc
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1235
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1236 set diffopt-=internal
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1237 call DiffMaintainsChangeMark()
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1238 set diffopt+=internal
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1239 call DiffMaintainsChangeMark()
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1240
26815
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1241 set diffopt&
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1242 delfunc DiffMaintainsChangeMark
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1243 endfunc
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1244
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1245 " Test for 'patchexpr'
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1246 func Test_patchexpr()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1247 let g:patch_args = []
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1248 func TPatch()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1249 call add(g:patch_args, readfile(v:fname_in))
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1250 call add(g:patch_args, readfile(v:fname_diff))
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1251 call writefile(['output file'], v:fname_out)
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1252 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1253 set patchexpr=TPatch()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1254
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1255 call writefile(['input file'], 'Xinput')
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1256 call writefile(['diff file'], 'Xdiff')
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1257 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1258 edit Xinput
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1259 diffpatch Xdiff
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1260 call assert_equal('output file', getline(1))
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1261 call assert_equal('Xinput.new', bufname())
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1262 call assert_equal(2, winnr('$'))
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1263 call assert_true(&diff)
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1264
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1265 " Using a script-local function
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1266 func s:NewPatchExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1267 endfunc
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1268 set patchexpr=s:NewPatchExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1269 call assert_equal(expand('<SID>') .. 'NewPatchExpr()', &patchexpr)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1270 set patchexpr=<SID>NewPatchExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1271 call assert_equal(expand('<SID>') .. 'NewPatchExpr()', &patchexpr)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1272
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1273 call delete('Xinput')
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1274 call delete('Xdiff')
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1275 set patchexpr&
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1276 delfunc TPatch
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
1277 delfunc s:NewPatchExpr
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1278 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1279 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1280
20905
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1281 func Test_diff_rnu()
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1282 CheckScreendump
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1283
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1284 let content =<< trim END
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1285 call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1286 vnew
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1287 call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1288 windo diffthis
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1289 setlocal number rnu foldcolumn=0
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1290 END
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1291 call writefile(content, 'Xtest_diff_rnu')
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1292 let buf = RunVimInTerminal('-S Xtest_diff_rnu', {})
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1293
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1294 call VerifyScreenDump(buf, 'Test_diff_rnu_01', {})
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1295
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1296 call term_sendkeys(buf, "j")
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1297 call VerifyScreenDump(buf, 'Test_diff_rnu_02', {})
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1298 call term_sendkeys(buf, "j")
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1299 call VerifyScreenDump(buf, 'Test_diff_rnu_03', {})
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1300
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1301 " clean up
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1302 call StopVimInTerminal(buf)
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1303 call delete('Xtest_diff_rnu')
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1304 endfunc
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1305
21014
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1306 func Test_diff_multilineconceal()
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1307 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1308 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1309
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1310 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1311 call matchadd('Conceal', 'a\nb', 9, -1, {'conceal': 'Y'})
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1312 set cole=2 cocu=n
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1313 call setline(1, ["a", "b"])
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1314 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1315 redraw
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1316 endfunc
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1317
21321
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1318 func Test_diff_and_scroll()
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1319 " this was causing an ml_get error
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1320 set ls=2
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1321 for i in range(winheight(0) * 2)
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1322 call setline(i, i < winheight(0) - 10 ? i : i + 10)
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1323 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1324 vnew
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1325 for i in range(winheight(0)*2 + 10)
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1326 call setline(i, i < winheight(0) - 10 ? 0 : i)
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1327 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1328 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1329 wincmd p
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1330 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1331 execute 'normal ' . winheight(0) . "\<C-d>"
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1332
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1333 bwipe!
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1334 bwipe!
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1335 set ls&
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1336 endfunc
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1337
22818
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1338 func Test_diff_filler_cursorcolumn()
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1339 CheckScreendump
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1340
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1341 let content =<< trim END
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1342 call setline(1, ['aa', 'bb', 'cc'])
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1343 vnew
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1344 call setline(1, ['aa', 'cc'])
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1345 windo diffthis
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1346 wincmd p
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1347 setlocal cursorcolumn foldcolumn=0
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1348 norm! gg0
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1349 redraw!
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1350 END
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1351 call writefile(content, 'Xtest_diff_cuc')
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1352 let buf = RunVimInTerminal('-S Xtest_diff_cuc', {})
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1353
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1354 call VerifyScreenDump(buf, 'Test_diff_cuc_01', {})
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1355
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1356 call term_sendkeys(buf, "l")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1357 call term_sendkeys(buf, "\<C-l>")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1358 call VerifyScreenDump(buf, 'Test_diff_cuc_02', {})
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1359 call term_sendkeys(buf, "0j")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1360 call term_sendkeys(buf, "\<C-l>")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1361 call VerifyScreenDump(buf, 'Test_diff_cuc_03', {})
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1362 call term_sendkeys(buf, "l")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1363 call term_sendkeys(buf, "\<C-l>")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1364 call VerifyScreenDump(buf, 'Test_diff_cuc_04', {})
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1365
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1366 " clean up
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1367 call StopVimInTerminal(buf)
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1368 call delete('Xtest_diff_cuc')
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1369 endfunc
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1370
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1371 " Test for adding/removing lines inside diff chunks, between diff chunks
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1372 " and before diff chunks
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1373 func Test_diff_modify_chunks()
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1374 enew!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1375 let w2_id = win_getid()
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1376 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1377 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1378 let w1_id = win_getid()
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1379 call setline(1, ['a', '2', '3', 'd', 'e', 'f', '7', '8', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1380 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1381
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1382 " remove a line between two diff chunks and create a new diff chunk
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1383 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1384 5d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1385 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1386 call diff_hlID(5, 1)->synIDattr('name')->assert_equal('DiffAdd')
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1387
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1388 " add a line between two diff chunks
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1389 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1390 normal! 4Goe
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1391 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1392 call diff_hlID(4, 1)->synIDattr('name')->assert_equal('')
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1393 call diff_hlID(5, 1)->synIDattr('name')->assert_equal('')
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1394
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1395 " remove all the lines in a diff chunk.
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1396 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1397 7,8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1398 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1399 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1400 call assert_equal(['', 'DiffText', 'DiffText', '', '', '', 'DiffAdd',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1401 \ 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1402
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1403 " remove lines from one diff chunk to just before the next diff chunk
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1404 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1405 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1406 2,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1407 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1408 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1409 call assert_equal(['', 'DiffText', 'DiffText', 'DiffAdd', 'DiffAdd',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1410 \ 'DiffAdd', 'DiffAdd', 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1411
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1412 " remove lines just before the top of a diff chunk
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1413 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1414 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1415 5,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1416 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1417 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1418 call assert_equal(['', 'DiffText', 'DiffText', '', 'DiffText', 'DiffText',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1419 \ 'DiffAdd', 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1420
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1421 " remove line after the end of a diff chunk
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1422 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1423 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1424 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1425 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1426 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1427 call assert_equal(['', 'DiffText', 'DiffText', 'DiffAdd', '', '', 'DiffText',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1428 \ 'DiffText', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1429
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1430 " remove lines starting from the end of one diff chunk and ending inside
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1431 " another diff chunk
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1432 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1433 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1434 4,7d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1435 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1436 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1437 call assert_equal(['', 'DiffText', 'DiffText', 'DiffText', 'DiffAdd',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1438 \ 'DiffAdd', 'DiffAdd', 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1439
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1440 " removing the only remaining diff chunk should make the files equal
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1441 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1442 call setline(1, ['a', '2', '3', 'x', 'd', 'e', 'f', 'x', '7', '8', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1443 8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1444 let hl = range(1, 10)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1445 call assert_equal(['', '', '', 'DiffAdd', '', '', '', '', '', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1446 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1447 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1448 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1449 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1450 call assert_equal(['', '', '', '', '', '', '', '', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1451
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1452 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1453 endfunc
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
1454
26794
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1455 func Test_diff_binary()
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1456 CheckScreendump
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1457
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1458 let content =<< trim END
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1459 call setline(1, ['a', 'b', "c\n", 'd', 'e', 'f', 'g'])
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1460 vnew
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1461 call setline(1, ['A', 'b', 'c', 'd', 'E', 'f', 'g'])
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1462 windo diffthis
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1463 wincmd p
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1464 norm! gg0
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1465 redraw!
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1466 END
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1467 call writefile(content, 'Xtest_diff_bin')
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1468 let buf = RunVimInTerminal('-S Xtest_diff_bin', {})
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1469
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1470 " Test using internal diff
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1471 call VerifyScreenDump(buf, 'Test_diff_bin_01', {})
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1472
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1473 " Test using internal diff and case folding
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1474 call term_sendkeys(buf, ":set diffopt+=icase\<cr>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1475 call term_sendkeys(buf, "\<C-l>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1476 call VerifyScreenDump(buf, 'Test_diff_bin_02', {})
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1477 " Test using external diff
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1478 call term_sendkeys(buf, ":set diffopt=filler\<cr>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1479 call term_sendkeys(buf, "\<C-l>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1480 call VerifyScreenDump(buf, 'Test_diff_bin_03', {})
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1481 " Test using external diff and case folding
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1482 call term_sendkeys(buf, ":set diffopt=filler,icase\<cr>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1483 call term_sendkeys(buf, "\<C-l>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1484 call VerifyScreenDump(buf, 'Test_diff_bin_04', {})
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1485
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1486 " clean up
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1487 call StopVimInTerminal(buf)
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1488 call delete('Xtest_diff_bin')
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1489 set diffopt&vim
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1490 endfunc
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1491
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1492 " Test for using the 'zi' command to invert 'foldenable' in diff windows (test
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1493 " for the issue fixed by patch 6.2.317)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1494 func Test_diff_foldinvert()
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1495 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1496 edit Xfile1
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1497 new Xfile2
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1498 new Xfile3
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1499 windo diffthis
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1500 " open a non-diff window
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1501 botright new
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1502 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1503 call assert_true(getwinvar(1, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1504 call assert_true(getwinvar(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1505 call assert_true(getwinvar(3, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1506 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1507 call assert_false(getwinvar(1, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1508 call assert_false(getwinvar(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1509 call assert_false(getwinvar(3, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1510 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1511 call assert_true(getwinvar(1, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1512 call assert_true(getwinvar(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1513 call assert_true(getwinvar(3, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1514
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1515 " If the current window has 'noscrollbind', then 'zi' should not change
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1516 " 'foldenable' in other windows.
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1517 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1518 set noscrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1519 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1520 call assert_false(getwinvar(1, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1521 call assert_true(getwinvar(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1522 call assert_true(getwinvar(3, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1523
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1524 " 'zi' should not change the 'foldenable' for windows with 'noscrollbind'
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1525 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1526 set scrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1527 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1528 call setwinvar(2, '&scrollbind', v:false)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1529 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1530 call assert_false(getwinvar(1, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1531 call assert_true(getwinvar(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1532 call assert_false(getwinvar(3, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1533
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1534 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1535 set scrollbind&
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1536 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1537
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1538 " This was scrolling for 'cursorbind' but 'scrollbind' is more important
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1539 func Test_diff_scroll()
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1540 CheckScreendump
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1541
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1542 let left =<< trim END
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1543 line 1
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1544 line 2
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1545 line 3
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1546 line 4
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1547
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1548 // Common block
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1549 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1550 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1551 // four lines
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1552
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1553 // Common block
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1554 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1555 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1556 // four lines
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1557 END
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1558 call writefile(left, 'Xleft')
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1559 let right =<< trim END
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1560 line 1
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1561 line 2
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1562 line 3
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1563 line 4
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1564
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1565 Lorem
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1566 ipsum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1567 dolor
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1568 sit
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1569 amet,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1570 consectetur
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1571 adipiscing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1572 elit.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1573 Etiam
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1574 luctus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1575 lectus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1576 sodales,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1577 dictum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1578
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1579 // Common block
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1580 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1581 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1582 // four lines
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1583
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1584 Vestibulum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1585 tincidunt
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1586 aliquet
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1587 nulla.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1588
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1589 // Common block
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1590 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1591 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1592 // four lines
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1593 END
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1594 call writefile(right, 'Xright')
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1595 let buf = RunVimInTerminal('-d Xleft Xright', {'rows': 12})
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1596 call term_sendkeys(buf, "\<C-W>\<C-W>jjjj")
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1597 call VerifyScreenDump(buf, 'Test_diff_scroll_1', {})
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1598 call term_sendkeys(buf, "j")
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1599 call VerifyScreenDump(buf, 'Test_diff_scroll_2', {})
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1600
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1601 call StopVimInTerminal(buf)
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1602 call delete('Xleft')
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1603 call delete('Xright')
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1604 endfunc
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1605
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1606
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1607 " vim: shiftwidth=2 sts=2 expandtab