annotate src/testdir/test_diffmode.vim @ 29767:2e2f57f2875d v9.0.0223

patch 9.0.0223: typo in diffmode test Commit: https://github.com/vim/vim/commit/5fd6ab820b4a0aaa5c6020852f39d118375fab49 Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Aug 17 12:09:45 2022 +0100 patch 9.0.0223: typo in diffmode test Problem: Typo in diffmode test. Solution: Fix the typo. (closes https://github.com/vim/vim/issues/10932)
author Bram Moolenaar <Bram@vim.org>
date Wed, 17 Aug 2022 13:15:03 +0200
parents 3afe997f4415
children 98f5a0618a77
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
29299
922b87383277 patch 8.2.5166: test for DiffUpdated fails
Bram Moolenaar <Bram@vim.org>
parents: 29295
diff changeset
37 " depending on how redraw is done DiffUpdated may be triggered once or twice
922b87383277 patch 8.2.5166: test for DiffUpdated fails
Bram Moolenaar <Bram@vim.org>
parents: 29295
diff changeset
38 call assert_inrange(1, 2, g:update_count)
14770
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
39 au! DiffUpdated
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
40
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 windo diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 close!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 set nomodified
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 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
47 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
48 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
49 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
50 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
51
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
52 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
53 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
54 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
55 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
56 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
57
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
58 func Common_vert_split()
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 " 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
60 set notitle noicon
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 new
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 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
63 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 w! Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 normal dd
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 $
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 put
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 normal kkrXoxxx
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 w! Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 file Nop
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 normal ggoyyyjjjozzzz
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 set foldmethod=marker foldcolumn=4
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 vert diffsplit Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 vert diffsplit Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 call assert_equal(1, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal('diff', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call assert_equal(2, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call assert_equal(1, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal(1, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(0, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 let diff_fdm = &fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 let diff_fdc = &fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 " 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
92 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 " 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
94 " first window
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 wincmd p
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 call assert_equal(9, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call assert_equal(1, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call assert_equal(3, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 call assert_equal(7, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 " Test diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 diffoff!
29767
2e2f57f2875d patch 9.0.0223: typo in diffmode test
Bram Moolenaar <Bram@vim.org>
parents: 29519
diff changeset
141 1wincmd w
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 let &diff = 1
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 let &fdm = diff_fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 let &fdc = diff_fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 4wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 diffoff!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 1wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170
9696
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
171 call delete('Xtest')
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
172 call delete('Xtest2')
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 windo bw!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 func Test_filler_lines()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 " Test that diffing shows correct filler lines
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 enew!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 put =range(4,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 vnew
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 put =range(1,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 windo diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 wincmd h
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 call assert_equal(1, line('w0'))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 unlet! diff_fdm diff_fdc
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
188 windo diffoff
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
189 bwipe!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
190 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
191 endfunc
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
193 func Test_diffget_diffput()
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
194 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
195 let l = range(50)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
196 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
197 call assert_fails('diffget', 'E99:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
198 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
199 call assert_fails('diffget', 'E100:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
200 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
201 let l[10] = 'one'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
202 let l[20] = 'two'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
203 let l[30] = 'three'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
204 let l[40] = 'four'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
205 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
206 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
207 call assert_equal('one', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
208 11diffget
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
209 call assert_equal('10', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
210 21diffput
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
211 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
212 call assert_equal('two', getline(21))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
213 normal 31Gdo
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
214 call assert_equal('three', getline(31))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
215 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
216 normal 41Gdp
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
217 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
218 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
219 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
220 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
221 call assert_fails('diffget', 'E101:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
222
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
223 windo diffoff
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
224 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
225 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
226
14972
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
227 " 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
228 func Test_diffput_two()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
229 new a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
230 let win_a = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
231 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
232 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
233 new b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
234 let win_b = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
235 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
236 8del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
237 5del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
238 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
239 call win_gotoid(win_a)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
240 %diffput
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
241 call win_gotoid(win_b)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
242 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
243 bwipe! a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
244 bwipe! b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
245 endfunc
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
246
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
247 " 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
248 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
249 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
250 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
251 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
252 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
253 3,5diffget
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
254 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
255 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
256 4,8diffput
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
257 wincmd p
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
258 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
259 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
260 endfunc
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
261
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
262 " 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
263 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
264 %d _
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
265 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
266 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
267 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
268 diffget
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
269 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
270 %d _
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
271 diffput
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
272 wincmd p
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
273 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
274 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
275 endfunc
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
276
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
277 " :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
278 " 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
279 " 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
280 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
281 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
282 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
283 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
284 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
285
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
286 wincmd t
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
287 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
288 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
289 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
290 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
291 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
292 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
293
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
294 " 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
295 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
296 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
297 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
298 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
299 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
300 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
301 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
302
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
303 " 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
304 " 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
305 wincmd j
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('Xdiff3', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
307 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
308 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
309 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
310 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
311 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
312 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
313
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
314 wincmd j
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('Xdiff3', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
316 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
317 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
318 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
319 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
320 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
321 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
322
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
323 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
324 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
325 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
326 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
327 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
328 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
329 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
330
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
331 %bwipe
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
332 endfunc
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
333
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
334 func Test_dp_do_buffer()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
335 e! one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
336 let bn1=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
337 let l = range(60)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
338 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
339 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
340
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
341 new two
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
342 let l[10] = 'one'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
343 let l[20] = 'two'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
344 let l[30] = 'three'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
345 let l[40] = 'four'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
346 let l[50] = 'five'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
347 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
348 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
349
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
350 " 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
351 11
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
352 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
353 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
354 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
355 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
356
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
357 " 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
358 call assert_equal('one', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
359 exe 'norm ' . bn1 . 'do'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
360 call assert_equal('10', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
361 21
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
362 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
363 diffget one
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
364 call assert_equal('20', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
365
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
366 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
367 exe 'norm ' . bn1 . 'dp'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
368 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
369 diffput one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
370 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
371 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
372 call assert_equal('three', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
373 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
374 call assert_equal('four', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
375
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
376 " 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
377 new not_in_diff_mode
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
378 let bn3=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
379 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
380 51
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 . "dp"', 'E103:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
382 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
383 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
384 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
385
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
386 windo diffoff
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
387 %bwipe!
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
388 endfunc
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
389
14893
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
390 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
391 e! one
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
392 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
393 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
394
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
395 new two
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
396 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
397 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
398
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
399 1
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 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
402 wincmd w
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
403 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
404 norm G
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
405 norm do
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
406 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
407
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
408 windo diffoff
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
409 %bwipe!
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
410 endfunc
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
411
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
412 func Test_diffoff()
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
413 enew!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
414 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
415 redraw
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
416 let normattr = screenattr(1, 1)
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
417 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
418 botright vert new
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
419 call setline(1, ['One', '', 'Two', 'Three'])
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
420 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
421 redraw
17994
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
422 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
423 diffoff!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
424 redraw
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
425 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
426 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
427 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
428 endfunc
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
429
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
430 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
431 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
432 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
433 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
434 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
435 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
436
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
437 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
438 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
439 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
440
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
441 redraw
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(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
443 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
444 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
445 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
446
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
447 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
448 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
449 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
450
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
451 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
452 %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
453 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
454
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
455 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
456 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
457 call Common_icase_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
458 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
459 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
460
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
461 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
462 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
463 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
464 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
465 endfunc
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
466
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
467 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
468 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
469 " 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
470 " 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
471 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
472 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
473 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
474 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
475
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
476 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
477 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
478 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
479
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
480 redraw
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(1, 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(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
483 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
484 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
485 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
486 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
487
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
488 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
489 %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
490 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
491
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
492 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
493 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
494 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
495 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
496 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
497
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
498 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
499 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
500 call Common_iwhite_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
501 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
502 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
503
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
504 func Test_diffopt_context()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
505 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
506 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
507 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
508 new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
509 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
510 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
511
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
512 set diffopt=context:2
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
513 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
514 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
515 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
516
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
517 set diffopt=context:1
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
518 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
519 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
520 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
521
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
522 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
523 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
524 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
525 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
526
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
527 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
528 set diffopt=internal,horizontal
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
529 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
530
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(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
532 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
533 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
534 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
535
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
536 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
537 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
538 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
539 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
540
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
541 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
542 set diffopt=internal,vertical
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
543 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
544
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(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
546 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
547 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
548 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
549
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
550 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
551 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
552 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
553 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
554
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
555 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
556 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
557 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
558 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
559 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
560 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
561 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
562 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
563 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
564 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
565 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
566 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
567 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
568 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
569 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
570 " 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
571 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
572
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 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
575 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
576 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
577
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
578 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
579 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
580 e! one
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
581 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
582 redraw
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
583 let normattr = screenattr(1, 1)
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
584 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
585 botright vert new two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
586 call setline(1, ['One', 'Four'])
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
587 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
588 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
589 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
590 set hidden
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
591 close
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
592 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
593 " diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
594 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
595 diffoff
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
596 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
597 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
598 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
599 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
600 " 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
601 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
602 diffoff!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
603 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
604 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
605 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
606 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
607 " 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
608 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
609
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 bwipe!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
612 set hidden& diffopt&
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
613 endfunc
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
614
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
615 func Test_setting_cursor()
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
616 new Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
617 put =range(1,90)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
618 wq
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
619 new Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
620 put =range(1,100)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
621 wq
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
622
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
623 tabe Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
624 $
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
625 diffsp Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
626 tabclose
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
627
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
628 call delete('Xtest1')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
629 call delete('Xtest2')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
630 endfunc
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
631
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
632 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
633 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
634 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
635 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
636 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
637 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
638 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
639 norm ]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
640 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
641 norm 3]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
642 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
643 norm 10]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
644 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
645 norm [c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
646 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
647 norm 2[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
648 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
649 norm 10[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
650 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
651 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
652 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
653
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
654 func Test_diffexpr()
23027
f74978697fb6 patch 8.2.2060: check for features implemented with "if"
Bram Moolenaar <Bram@vim.org>
parents: 22818
diff changeset
655 CheckExecutable diff
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
656
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
657 func DiffExpr()
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
658 " 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
659 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
660 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
661 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
662 set diffexpr=DiffExpr()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
663 set diffopt=foldcolumn:0
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
664
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
665 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
666 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
667 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
668 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
669 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
670
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
671 botright vert new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
672 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
673 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
674
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
675 redraw
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(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
677 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
678 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
679 diffoff!
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
680
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26044
diff changeset
681 " 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
682 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
683 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
684 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
685
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 " 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
687 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
688 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
689 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
690 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
691 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
692 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
693
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
694 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
695 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
696 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
697 delfunc s:NewDiffExpr
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
698 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
699
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
700 func Test_diffpatch()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
701 " 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
702 CheckExecutable patch
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21321
diff changeset
703 CheckUnix
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
704 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
705 insert
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
706 ***************
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
707 *** 1,3 ****
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
708 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
709 ! 2
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
710 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
711 --- 1,4 ----
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
712 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
713 ! 2x
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
714 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
715 + 4
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
716 .
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
717 saveas! Xpatch
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
718 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
719 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
720 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
721
11113
081ed9efb5c0 patch 8.0.0444: diffpatch fails when the file name has a quote
Christian Brabandt <cb@256bit.org>
parents: 11109
diff changeset
722 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
723 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
724 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
725 call rename('Xpatch', name)
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
726 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
727 exe 'diffpatch ' . escape(name, '$')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
728 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
729 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
730 call rename(name, 'Xpatch')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
731 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
732 bwipe!
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
733 endfor
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
734
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
735 call delete('Xpatch')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
736 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
737 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
738
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
739 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
740 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
741 exe "new Xtest" . i
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
742 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
743 endfor
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
744 new Xtest9
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
745 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
746 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
747 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
748
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
749 func Test_diff_nomodifiable()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
750 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
751 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
752 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
753 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
754 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
755 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
756 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
757 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
758 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
759 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
760 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
761 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
762
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
763 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
764 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
765 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
766 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
767 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
768 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
769 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
770 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
771
17624
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
772 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
773
17624
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, 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
775 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
776 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
777 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
778 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
779
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
780 wincmd w
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(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
782 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
783 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
784
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
785 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
786 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
787
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
788 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
789 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
790 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
791 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
792 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
793 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
794 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
795 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
796
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17624
diff changeset
797 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
798 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
799 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
800
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
801 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
802 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
803
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
804 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
805 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
806 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
807 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
808 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
809 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
810 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
811 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
812 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
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 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
815 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
816 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
817 $
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 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
819 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
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 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
822 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
823
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
824 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
825 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
826 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
827 if a:buf
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
828 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
829 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
830 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
831
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
832 " 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
833 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
834 " 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
835 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
836 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
837 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
838 " 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
839 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
840 endif
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
841 endfor
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
842
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
843 " also test unified diff
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
844 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
845 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
846 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
847 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
848 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
849
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
850 " 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
851 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
852 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
853 " 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
854 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
855 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
856 endfunc
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
857
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
858 func Test_diff_screen()
25969
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 25717
diff changeset
859 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
860 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
861 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
862
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
863 let lines =<< trim END
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
864 func UnifiedDiffExpr()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
865 " 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
866 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
867 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
868 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
869 func SetupUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
870 set diffexpr=UnifiedDiffExpr()
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
871 diffupdate
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
872 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
873 func StopUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
874 set diffexpr=
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
875 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
876 END
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
877 call writefile(lines, 'XdiffSetup')
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
878
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
879 " 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
880 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
881 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
882
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
883 " 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
884 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
885 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
886 " 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
887 " files
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
888 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
889
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
890 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
891
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
892 " 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
893 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
894 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
895
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
896 " 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
897 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
898 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
899
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
900 " 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
901 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
902 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
903
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
904 " 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
905 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
906 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
907
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
908 " 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
909 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
910 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
911
15900
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
912 " 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
913 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
914 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
915 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
916 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
917 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
918 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
919 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
920 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
921 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
922
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
923 " 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
924 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
925 \ ' 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
926 \ ' 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
927 \ ' 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
928 \ '{', ' 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
929 \ ['#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
930 \ ' 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
931 \ '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
932 \ ' 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
933 \ '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
934 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
935 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
936 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
937
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 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
939 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
940
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 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
942 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
943
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
944 " 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
945 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
946 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
947 \ ['', ' 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
948 \ ' 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
949 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
950 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
951 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
952
15103
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
953 " Leave trailing : at commandline!
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
954 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
955 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
956 " 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
957 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
958 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
959 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
960 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
961 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
962 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
963
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
964 " 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
965 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
966 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
967
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
968 " 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
969 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
970 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
971
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
972 " 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
973 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
974 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
975
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
976 " 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
977 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
978 \ ['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
979 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
980 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
981 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
982 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
983 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
984
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
985 " 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
986 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
987 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
988
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
989 " 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
990 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
991 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
992 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
993
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
994 " 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
995 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
996 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
997
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
998 " 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
999 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
1000
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1001 " 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
1002 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
1003 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
1004 call delete('Xfile2')
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
1005 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
1006 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1007
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
1008 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
1009 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
1010
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 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
1012 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
1013 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
1014 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
1015 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
1016 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
1017 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
1018 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
1019 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
1020 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
1021
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 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
1023
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 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
1025 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
1026
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
1027 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
1028 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
1029
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
1030 " 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
1031 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
1032 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
1033 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
1034
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1035 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
1036 CheckScreendump
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1037
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1038 call writefile([
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1039 \ '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
1040 \ 'set cursorline',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1041 \ '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
1042 \ 'vnew',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1043 \ '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
1044 \ 'windo diffthis',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1045 \ '2wincmd w',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1046 \ ], 'Xtest_diff_cursorline')
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1047 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
1048
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1049 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
1050 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
1051 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
1052 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
1053 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
1054
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1055 " clean up
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1056 call StopVimInTerminal(buf)
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1057 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
1058 endfunc
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1059
27990
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1060 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
1061 CheckScreendump
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1062
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1063 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
1064 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
1065 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
1066 set cursorline number
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1067 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
1068 2
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1069 vnew
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1070 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
1071 windo diffthis
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1072 1wincmd w
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1073 END
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1074 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
1075 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
1076
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1077 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
1078 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
1079 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
1080
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1081 " clean up
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1082 call StopVimInTerminal(buf)
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1083 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
1084 endfunc
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1085
25517
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1086 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
1087 CheckScreendump
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1088
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1089 call writefile([
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1090 \ '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
1091 \ '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
1092 \ '50vnew',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1093 \ 'call setline(1, [" "," "," "," "])',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1094 \ '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
1095 \ 'vnew',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1096 \ 'call setline(1, [" "," "," "," "])',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1097 \ '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
1098 \ 'windo diffthis',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1099 \ '2wincmd w',
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1100 \ ], '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 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
1102
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1103 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
1104 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
1105 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
1106 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
1107 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
1108 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
1109 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
1110 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
1111
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1112 " clean up
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1113 call StopVimInTerminal(buf)
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1114 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
1115 endfunc
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1116
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1117 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
1118 CheckScreendump
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1119
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1120 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
1121 void doNothing() {
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1122 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
1123 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
1124 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1125 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1126 END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1127 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
1128 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
1129 void doSomething() {
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1130 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
1131 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
1132 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1133 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1134 END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1135 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
1136
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1137 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
1138 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
1139 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
1140 END
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1141 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
1142 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
1143
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1144 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
1145
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1146 " clean up
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1147 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
1148 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
1149 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
1150 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
1151 endfunc
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1152
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1153 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
1154 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
1155 CheckFeature rightleft
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1156
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1157 call writefile([
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1158 \ '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
1159 \ 'vnew',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1160 \ '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
1161 \ '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
1162 \ '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
1163 \ 'setlocal number',
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1164 \ ], 'Xtest_diff_diff')
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1165 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
1166
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1167 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
1168
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
1169 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
1170 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
1171
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1172 " clean up
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1173 call StopVimInTerminal(buf)
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1174 call delete('Xtest_diff_diff')
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1175 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
1176
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1177 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
1178 enew
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1179 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
1180 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1181 new
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1182 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
1183 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1184 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
1185 only!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1186 endfunc
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1187
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1188 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
1189 " "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
1190 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
1191 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
1192 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1193
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1194 " "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
1195 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
1196 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
1197 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
1198 diffoff!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1199 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1200 endfunc
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1201
23895
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1202 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
1203 new
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 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
1205 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
1206 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1207 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
1208 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1209 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
1210 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1211 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
1212 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1213 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
1214 bwipe!
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1215 endfunc
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1216
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1217 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
1218 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
1219 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
1220 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
1221 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
1222 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
1223 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
1224 " 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
1225 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
1226 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
1227 " 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
1228 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
1229 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
1230 " 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
1231 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
1232 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
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 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
1235 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
1236
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 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
1238 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
1239 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
1240 call DiffMaintainsChangeMark()
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1241
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
1242 set diffopt&
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1243 delfunc DiffMaintainsChangeMark
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1244 endfunc
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1245
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1246 " Test for 'patchexpr'
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1247 func Test_patchexpr()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1248 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
1249 func TPatch()
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_in))
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1251 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
1252 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
1253 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1254 set patchexpr=TPatch()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1255
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1256 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
1257 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
1258 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1259 edit Xinput
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1260 diffpatch Xdiff
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('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
1262 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
1263 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
1264 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
1265
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
1266 " 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
1267 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
1268 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
1269 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
1270 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
1271 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
1272 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
1273
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1274 call delete('Xinput')
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1275 call delete('Xdiff')
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1276 set patchexpr&
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1277 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
1278 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
1279 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1280 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1281
20905
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1282 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
1283 CheckScreendump
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1284
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1285 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
1286 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
1287 vnew
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1288 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
1289 windo diffthis
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1290 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
1291 END
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1292 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
1293 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
1294
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1295 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
1296
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1297 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
1298 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
1299 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
1300 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
1301
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1302 " clean up
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1303 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
1304 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
1305 endfunc
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1306
21014
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1307 func Test_diff_multilineconceal()
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1308 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1309 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1310
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1311 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1312 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
1313 set cole=2 cocu=n
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1314 call setline(1, ["a", "b"])
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1315 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1316 redraw
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1317 endfunc
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1318
21321
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1319 func Test_diff_and_scroll()
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1320 " 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
1321 set ls=2
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1322 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
1323 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
1324 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1325 vnew
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1326 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
1327 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
1328 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1329 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1330 wincmd p
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1331 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1332 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
1333
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 bwipe!
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1336 set ls&
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1337 endfunc
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1338
22818
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1339 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
1340 CheckScreendump
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1341
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1342 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
1343 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
1344 vnew
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1345 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
1346 windo diffthis
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1347 wincmd p
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1348 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
1349 norm! gg0
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1350 redraw!
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1351 END
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1352 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
1353 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
1354
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1355 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
1356
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, "l")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1358 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
1359 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
1360 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
1361 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
1362 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
1363 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
1364 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
1365 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
1366
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1367 " clean up
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1368 call StopVimInTerminal(buf)
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1369 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
1370 endfunc
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1371
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1372 " 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
1373 " 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
1374 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
1375 enew!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1376 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
1377 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
1378 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1379 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
1380 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
1381 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1382
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1383 " 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
1384 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
1385 5d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1386 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
1387 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
1388
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1389 " 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
1390 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
1391 normal! 4Goe
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1392 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
1393 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
1394 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
1395
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1396 " 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
1397 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
1398 7,8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1399 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
1400 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
1401 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
1402 \ 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1403
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1404 " 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
1405 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
1406 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
1407 2,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1408 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
1409 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
1410 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
1411 \ '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
1412
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1413 " 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
1414 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
1415 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
1416 5,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1417 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
1418 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
1419 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
1420 \ '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
1421
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1422 " 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
1423 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
1424 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
1425 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1426 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
1427 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
1428 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
1429 \ 'DiffText', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1430
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1431 " 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
1432 " 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
1433 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
1434 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
1435 4,7d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1436 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
1437 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
1438 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
1439 \ '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
1440
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1441 " 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
1442 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
1443 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
1444 8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1445 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
1446 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
1447 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
1448 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1449 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
1450 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
1451 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
1452
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1453 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1454 endfunc
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
1455
26794
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1456 func Test_diff_binary()
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1457 CheckScreendump
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1458
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1459 let content =<< trim END
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1460 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
1461 vnew
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1462 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
1463 windo diffthis
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1464 wincmd p
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1465 norm! gg0
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1466 redraw!
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1467 END
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1468 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
1469 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
1470
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1471 " Test using internal diff
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1472 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
1473
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1474 " 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
1475 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
1476 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
1477 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
1478 " Test using external diff
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, ":set diffopt=filler\<cr>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1480 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
1481 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
1482 " 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
1483 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
1484 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
1485 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
1486
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1487 " clean up
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1488 call StopVimInTerminal(buf)
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1489 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
1490 set diffopt&vim
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1491 endfunc
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1492
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1493 " 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
1494 " 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
1495 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
1496 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1497 edit Xfile1
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1498 new Xfile2
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1499 new Xfile3
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1500 windo diffthis
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1501 " 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
1502 botright new
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1503 1wincmd w
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(1, '&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(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1506 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
1507 normal zi
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(1, '&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(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1510 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
1511 normal zi
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(1, '&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(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1514 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
1515
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1516 " 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
1517 " '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
1518 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1519 set noscrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1520 normal zi
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_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
1522 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
1523 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
1524
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1525 " '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
1526 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1527 set scrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1528 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1529 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
1530 normal zi
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_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
1532 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
1533 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
1534
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1535 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1536 set scrollbind&
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1537 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1538
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1539 " 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
1540 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
1541 CheckScreendump
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1542
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1543 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
1544 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
1545 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
1546 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
1547 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
1548
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1549 // 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
1550 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1551 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1552 // 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
1553
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1554 // 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
1555 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1556 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1557 // 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
1558 END
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1559 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
1560 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
1561 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
1562 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
1563 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
1564 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
1565
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1566 Lorem
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1567 ipsum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1568 dolor
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1569 sit
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1570 amet,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1571 consectetur
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1572 adipiscing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1573 elit.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1574 Etiam
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1575 luctus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1576 lectus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1577 sodales,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1578 dictum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1579
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1580 // 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
1581 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1582 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1583 // 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
1584
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1585 Vestibulum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1586 tincidunt
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1587 aliquet
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1588 nulla.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1589
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1590 // 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
1591 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1592 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1593 // 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
1594 END
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1595 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
1596 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
1597 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
1598 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
1599 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
1600 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
1601
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 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
1603 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
1604 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
1605 endfunc
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1606
29293
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1607 " This was trying to update diffs for a buffer being closed
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1608 func Test_diff_only()
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1609 silent! lfile
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1610 set diff
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1611 lopen
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1612 norm o
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1613 silent! norm o
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1614
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1615 set nodiff
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1616 %bwipe!
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1617 endfunc
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1618
29295
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1619 " This was causing invalid diff block values
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1620 " FIXME: somehow this causes a valgrind error when run directly but not when
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1621 " run as a test.
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1622 func Test_diff_manipulations()
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1623 set diff
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1624 split 0
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1625 sil! norm R doobdeuR doobdeuR doobdeu
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1626
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1627 set nodiff
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1628 %bwipe!
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1629 endfunc
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1630
29519
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1631 " This was causing the line number in the diff block to go below one.
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1632 " FIXME: somehow this causes a valgrind error when run directly but not when
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1633 " run as a test.
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1634 func Test_diff_put_and_undo()
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1635 set diff
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1636 next 0
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1637 split 00
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1638 sil! norm o0gguudpo0ggJuudp
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1639
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1640 bwipe!
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1641 bwipe!
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1642 set nodiff
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1643 endfunc
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1644
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1645
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1646 " vim: shiftwidth=2 sts=2 expandtab