annotate src/testdir/test_diffmode.vim @ 34259:70c1a9c6f41d v9.1.0070

patch 9.1.0070: CI: testsuite not run on M1 Mac Commit: https://github.com/vim/vim/commit/e93d5cadec6323d6be90f1ec29066441ffbc9477 Author: rhysd <lin90162@yahoo.co.jp> Date: Thu Feb 1 21:22:14 2024 +0100 patch 9.1.0070: CI: testsuite not run on M1 Mac Problem: CI: testsuite not run on M1 Mac Solution: Make it run on gh runners for M1, disable failing tests for now, until we figure the problem with the failings tests out (rhysd) closes: #13943 Signed-off-by: rhysd <lin90162@yahoo.co.jp> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 01 Feb 2024 21:30:03 +0100
parents 3d0544e31ca5
children cce6b834635c
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('.'))
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
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
32218
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
739 " FIXME: test fails, the Xresult file can't be read
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
740 func No_Test_diffpatch_restricted()
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
741 let lines =<< trim END
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
742 call assert_fails('diffpatch NoSuchDiff', 'E145:')
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
743
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
744 call writefile(v:errors, 'Xresult')
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
745 qa!
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
746 END
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
747 call writefile(lines, 'Xrestricted', 'D')
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
748 if RunVim([], [], '-Z --clean -S Xrestricted')
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
749 call assert_equal([], readfile('Xresult'))
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
750 endif
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
751 call delete('Xresult')
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
752 endfunc
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
753
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
754 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
755 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
756 exe "new Xtest" . i
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
757 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
758 endfor
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
759 new Xtest9
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
760 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
761 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
762 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
763
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
764 func Test_diff_nomodifiable()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
765 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
766 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
767 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
768 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
769 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
770 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
771 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
772 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
773 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
774 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
775 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
776 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
777
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
778 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
779 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
780 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
781 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
782 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
783 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
784 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
785 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
786
17624
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
787 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
788
17624
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
789 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
790 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
791 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
792 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
793 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
794
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
795 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
796 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
797 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
798 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
799
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
800 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
801 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
802
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
803 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
804 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
805 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
806 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
807 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
808 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
809 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
810 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
811
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17624
diff changeset
812 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
813 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
814 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
815
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
816 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
817 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
818
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
819 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
820 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
821 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
822 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
823 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
824 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
825 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
826 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
827 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
828 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
829 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
830 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
831 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
832 $
f5bd684e47a1 patch 8.0.0421: diff mode wrong when adding line at end of buffer
Christian Brabandt <cb@256bit.org>
parents: 10984
diff changeset
833 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
834 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
835 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
836 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
837 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
838
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
839 func WriteDiffFiles(buf, list1, list2)
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
840 call writefile(a:list1, 'Xdifile1')
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
841 call writefile(a:list2, 'Xdifile2')
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
842 if a:buf
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
843 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
844 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
845 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
846
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
847 " 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
848 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
849 " 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
850 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
851 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
852 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
853 " 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
854 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
855 endif
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
856 endfor
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
857
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
858 " also test unified diff
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
859 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
860 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
861 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
862 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
863 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
864
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
865 " 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
866 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
867 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
868 " 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
869 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
870 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
871 endfunc
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
872
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
873 func Test_diff_screen()
34259
70c1a9c6f41d patch 9.1.0070: CI: testsuite not run on M1 Mac
Christian Brabandt <cb@256bit.org>
parents: 33884
diff changeset
874 if has('osx') && !empty($CI) && system('uname -m') =~# 'arm64'
70c1a9c6f41d patch 9.1.0070: CI: testsuite not run on M1 Mac
Christian Brabandt <cb@256bit.org>
parents: 33884
diff changeset
875 throw 'Skipped: FIXME: This test fails on M1 Mac on GitHub Actions'
70c1a9c6f41d patch 9.1.0070: CI: testsuite not run on M1 Mac
Christian Brabandt <cb@256bit.org>
parents: 33884
diff changeset
876 endif
70c1a9c6f41d patch 9.1.0070: CI: testsuite not run on M1 Mac
Christian Brabandt <cb@256bit.org>
parents: 33884
diff changeset
877
25969
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 25717
diff changeset
878 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
879 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
880 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
881
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
882 let lines =<< trim END
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
883 func UnifiedDiffExpr()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
884 " 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
885 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
886 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
887 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
888 func SetupUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
889 set diffexpr=UnifiedDiffExpr()
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
890 diffupdate
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
891 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
892 func StopUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
893 set diffexpr=
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
894 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
895 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
896 call writefile(lines, 'XdiffSetup', 'D')
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
897
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 " clean up already existing swap files, just in case
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
899 call delete('.Xdifile1.swp')
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
900 call delete('.Xdifile2.swp')
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
901
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
902 " 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
903 call WriteDiffFiles(0, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
904 let buf = RunVimInTerminal('-d -S XdiffSetup Xdifile1 Xdifile2', {})
16135
dc0801e374e0 patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents: 15900
diff changeset
905 " 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
906 " files
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
907 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
908
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
909 call VerifyBoth(buf, 'Test_diff_01', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
910
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
911 " 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
912 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
913 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
914
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
915 " 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
916 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
917 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
918
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
919 " 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
920 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
921 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
922
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 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
924 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
925 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
926
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
927 " 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
928 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
929 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
930
15900
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
931 " 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
932 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
933 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
934 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
935 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
936 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
937 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
938 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
939 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
940 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
941
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
942 " 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
943 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
944 \ ' 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
945 \ ' 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
946 \ ' 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
947 \ '{', ' 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
948 \ ['#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
949 \ ' 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
950 \ '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
951 \ ' 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
952 \ '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
953 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
954 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
955 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
956
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
957 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
958 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
959
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
960 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
961 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
962
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
963 " Test 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
964 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
965 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
966 \ ['', ' 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
967 \ ' 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
968 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
969 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
970 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
971
15103
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
972 " Leave trailing : at commandline!
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
973 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
974 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
975 " 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
976 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
977 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
978 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
979 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
980 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
981 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
982
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
983 " 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
984 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
985 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
986
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
987 " 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
988 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
989 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
990
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
991 " 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
992 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
993 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
994
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
995 " 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
996 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
997 \ ['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
998 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
999 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
1000 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
1001 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
1002 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
1003
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1004 " 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
1005 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
1006 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
1007
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1008 " 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
1009 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
1010 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
1011 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
1012
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1013 " 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
1014 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
1015 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
1016
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1017 " 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
1018 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
1019
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1020 " 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
1021 call StopVimInTerminal(buf)
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
1022 call delete('Xdifile1')
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
1023 call delete('Xdifile2')
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1024 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1025
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
1026 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
1027 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
1028
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1029 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
1030 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
1031 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
1032 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
1033 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
1034 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
1035 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
1036 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1037 call writefile(lines, 'Xtest_scroll_change', 'D')
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
1038 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
1039
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1040 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
1041
d3f992bc6ef8 patch 8.2.3394: filler lines are wrong when changing text in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 25517
diff changeset
1042 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
1043 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
1044
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
1045 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
1046 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
1047
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
1048 " 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
1049 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
1050 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
1051
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1052 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
1053 CheckScreendump
14873
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 call writefile([
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1056 \ '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
1057 \ 'set cursorline',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1058 \ '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
1059 \ 'vnew',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1060 \ '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
1061 \ 'windo diffthis',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1062 \ '2wincmd w',
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1063 \ ], 'Xtest_diff_cursorline', 'D')
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1064 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
1065
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1066 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
1067 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
1068 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
1069 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
1070 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
1071
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1072 " clean up
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1073 call StopVimInTerminal(buf)
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1074 endfunc
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1075
27990
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1076 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
1077 CheckScreendump
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1078
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1079 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
1080 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
1081 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
1082 set cursorline number
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1083 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
1084 2
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1085 vnew
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1086 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
1087 windo diffthis
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1088 1wincmd w
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1089 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1090 call writefile(lines, 'Xtest_diff_cursorline_number', 'D')
27990
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1091 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
1092
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1093 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
1094 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
1095 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
1096
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1097 " clean up
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1098 call StopVimInTerminal(buf)
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1099 endfunc
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1100
25517
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1101 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
1102 CheckScreendump
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1103
33884
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1104 let lines =<< trim END
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1105 hi CursorLine ctermbg=red ctermfg=white
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1106 set noequalalways wrap diffopt=followwrap cursorline breakindent
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1107 50vnew
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1108 call setline(1, [' ', ' ', ' ', ' '])
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1109 exe "norm! 20Afoo\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abar\<Esc>"
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1110 vnew
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1111 call setline(1, [' ', ' ', ' ', ' '])
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1112 exe "norm! 20Abee\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abaz\<Esc>"
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1113 windo diffthis
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1114 2wincmd w
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1115 END
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1116 call writefile(lines, 'Xtest_diff_cursorline_breakindent', 'D')
25517
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1117 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
1118
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1119 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
1120 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
1121 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
1122 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
1123 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
1124 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
1125 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
1126 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
1127
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1128 " clean up
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1129 call StopVimInTerminal(buf)
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1130 endfunc
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1131
33884
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1132 func Test_diff_breakindent_after_filler()
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1133 CheckScreendump
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1134
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1135 let lines =<< trim END
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1136 set laststatus=0 diffopt+=followwrap breakindent
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1137 call setline(1, ['a', ' ' .. repeat('c', 50)])
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1138 vnew
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1139 call setline(1, ['a', 'b', ' ' .. repeat('c', 50)])
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1140 windo diffthis
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1141 norm! G$
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1142 END
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1143 call writefile(lines, 'Xtest_diff_breakindent_after_filler', 'D')
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1144 let buf = RunVimInTerminal('-S Xtest_diff_breakindent_after_filler', #{rows: 8, cols: 45})
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1145 call VerifyScreenDump(buf, 'Test_diff_breakindent_after_filler', {})
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1146
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1147 " clean up
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1148 call StopVimInTerminal(buf)
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1149 endfunc
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1150
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1151 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
1152 CheckScreendump
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1153
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1154 let lines =<< trim END
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1155 void doNothing() {
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1156 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
1157 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
1158 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1159 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1160 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1161 call writefile(lines, 'Xprogram1.c', 'D')
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1162 let lines =<< trim END
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1163 void doSomething() {
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1164 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
1165 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
1166 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1167 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1168 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1169 call writefile(lines, 'Xprogram2.c', 'D')
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1170
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1171 let lines =<< trim END
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1172 edit Xprogram1.c
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1173 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
1174 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1175 call writefile(lines, 'Xtest_diff_syntax', 'D')
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1176 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
1177
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1178 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
1179
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1180 " clean up
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1181 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
1182 endfunc
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1183
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1184 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
1185 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
1186 CheckFeature rightleft
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1187
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1188 call writefile([
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1189 \ '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
1190 \ 'vnew',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1191 \ '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
1192 \ '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
1193 \ '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
1194 \ 'setlocal number',
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1195 \ ], 'Xtest_diff_diff', 'D')
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1196 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
1197
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1198 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
1199
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
1200 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
1201 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
1202
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1203 " clean up
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1204 call StopVimInTerminal(buf)
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1205 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
1206
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1207 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
1208 enew
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1209 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
1210 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1211 new
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1212 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
1213 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1214 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
1215 only!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1216 endfunc
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1217
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1218 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
1219 " "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
1220 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
1221 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
1222 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1223
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1224 " "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
1225 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
1226 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
1227 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
1228 diffoff!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1229 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1230 endfunc
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1231
23895
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1232 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
1233 new
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1234 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
1235 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
1236 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1237 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
1238 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1239 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
1240 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1241 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
1242 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1243 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
1244 bwipe!
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1245 endfunc
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1246
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1247 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
1248 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
1249 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
1250 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
1251 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
1252 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
1253 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
1254 " 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
1255 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
1256 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
1257 " 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
1258 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
1259 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
1260 " 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
1261 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
1262 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
1263 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
1264 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
1265 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
1266
421d082c8f09 patch 8.2.3936: no proper test for maintaining change mark in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 26794
diff changeset
1267 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
1268 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
1269 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
1270 call DiffMaintainsChangeMark()
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1271
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
1272 set diffopt&
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1273 delfunc DiffMaintainsChangeMark
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1274 endfunc
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1275
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1276 " Test for 'patchexpr'
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1277 func Test_patchexpr()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1278 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
1279 func TPatch()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1280 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
1281 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
1282 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
1283 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1284 set patchexpr=TPatch()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1285
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1286 call writefile(['input file'], 'Xinput', 'D')
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1287 call writefile(['diff file'], 'Xdiff', 'D')
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1288 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1289 edit Xinput
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1290 diffpatch Xdiff
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1291 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
1292 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
1293 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
1294 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
1295
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
1296 " 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
1297 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
1298 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
1299 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
1300 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
1301 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
1302 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
1303
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1304 set patchexpr&
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1305 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
1306 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
1307 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1308 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1309
20905
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1310 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
1311 CheckScreendump
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1312
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1313 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
1314 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
1315 vnew
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1316 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
1317 windo diffthis
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1318 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
1319 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1320 call writefile(content, 'Xtest_diff_rnu', 'D')
20905
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1321 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
1322
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1323 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
1324
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1325 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
1326 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
1327 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
1328 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
1329
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1330 " clean up
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1331 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
1332 endfunc
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1333
21014
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1334 func Test_diff_multilineconceal()
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1335 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1336 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1337
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1338 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1339 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
1340 set cole=2 cocu=n
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1341 call setline(1, ["a", "b"])
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1342 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1343 redraw
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1344 endfunc
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1345
21321
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1346 func Test_diff_and_scroll()
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1347 " 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
1348 set ls=2
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1349 for i in range(winheight(0) * 2)
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1350 call setline(i, i < winheight(0) - 10 ? i : i + 10)
21321
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1351 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1352 vnew
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1353 for i in range(winheight(0)*2 + 10)
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1354 call setline(i, i < winheight(0) - 10 ? 0 : i)
21321
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1355 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1356 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1357 wincmd p
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1358 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1359 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
1360
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1361 bwipe!
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1362 bwipe!
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1363 set ls&
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1364 endfunc
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1365
22818
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1366 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
1367 CheckScreendump
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1368
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1369 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
1370 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
1371 vnew
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1372 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
1373 windo diffthis
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1374 wincmd p
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1375 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
1376 norm! gg0
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1377 redraw!
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1378 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1379 call writefile(content, 'Xtest_diff_cuc', 'D')
22818
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1380 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
1381
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1382 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
1383
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1384 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
1385 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
1386 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
1387 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
1388 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
1389 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
1390 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
1391 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
1392 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
1393
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1394 " clean up
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1395 call StopVimInTerminal(buf)
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1396 endfunc
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1397
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1398 " 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
1399 " 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
1400 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
1401 enew!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1402 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
1403 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
1404 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1405 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
1406 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
1407 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1408
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1409 " 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
1410 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
1411 5d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1412 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
1413 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
1414
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1415 " 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
1416 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
1417 normal! 4Goe
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1418 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
1419 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
1420 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
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 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
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 7,8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1425 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1426 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1427 call assert_equal(['', 'DiffText', 'DiffText', '', '', '', 'DiffAdd',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1428 \ 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1429
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1430 " remove lines 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
1431 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
1432 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
1433 2,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1434 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
1435 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
1436 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
1437 \ '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
1438
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1439 " 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
1440 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
1441 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
1442 5,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1443 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
1444 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
1445 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
1446 \ '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
1447
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1448 " 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
1449 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
1450 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
1451 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1452 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
1453 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
1454 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
1455 \ 'DiffText', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1456
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1457 " 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
1458 " 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
1459 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
1460 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
1461 4,7d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1462 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
1463 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
1464 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
1465 \ '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
1466
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1467 " 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
1468 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
1469 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
1470 8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1471 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
1472 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
1473 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
1474 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1475 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
1476 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
1477 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
1478
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1479 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1480 endfunc
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
1481
26794
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1482 func Test_diff_binary()
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1483 CheckScreendump
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1484
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1485 let content =<< trim END
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1486 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
1487 vnew
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1488 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
1489 windo diffthis
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1490 wincmd p
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1491 norm! gg0
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1492 redraw!
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1493 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1494 call writefile(content, 'Xtest_diff_bin', 'D')
26794
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1495 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
1496
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1497 " Test using internal diff
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1498 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
1499
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1500 " 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
1501 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
1502 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
1503 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
1504 " Test using external diff
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1505 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
1506 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
1507 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
1508 " 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
1509 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
1510 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
1511 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
1512
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1513 " clean up
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1514 call StopVimInTerminal(buf)
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1515 set diffopt&vim
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1516 endfunc
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1517
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1518 " 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
1519 " 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
1520 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
1521 %bw!
29997
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
1522 edit Xdoffile1
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
1523 new Xdoffile2
98f5a0618a77 patch 9.0.0336: tests are flaky because of using a common file name
Bram Moolenaar <Bram@vim.org>
parents: 29767
diff changeset
1524 new Xdoffile3
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1525 windo diffthis
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1526 " 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
1527 botright new
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1528 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1529 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
1530 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
1531 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
1532 normal zi
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(1, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1534 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
1535 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
1536 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1537 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
1538 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
1539 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
1540
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1541 " 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
1542 " '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
1543 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1544 set noscrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1545 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1546 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
1547 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
1548 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
1549
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1550 " '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
1551 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1552 set scrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1553 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1554 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
1555 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1556 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
1557 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
1558 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
1559
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1560 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1561 set scrollbind&
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1562 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1563
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1564 " 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
1565 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
1566 CheckScreendump
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1567
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1568 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
1569 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
1570 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
1571 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
1572 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
1573
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1574 // 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
1575 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1576 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1577 // 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
1578
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1579 // Common block
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1580 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1581 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1582 // four lines
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1583 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1584 call writefile(left, 'Xleft', 'D')
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1585 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
1586 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
1587 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
1588 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
1589 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
1590
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1591 Lorem
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1592 ipsum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1593 dolor
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1594 sit
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1595 amet,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1596 consectetur
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1597 adipiscing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1598 elit.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1599 Etiam
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1600 luctus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1601 lectus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1602 sodales,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1603 dictum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1604
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1605 // 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
1606 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1607 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1608 // 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
1609
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1610 Vestibulum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1611 tincidunt
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1612 aliquet
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1613 nulla.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1614
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1615 // 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
1616 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1617 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1618 // 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
1619 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1620 call writefile(right, 'Xright', 'D')
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1621 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
1622 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
1623 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
1624 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
1625 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
1626
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1627 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
1628 endfunc
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1629
32208
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1630 " This was scrolling too many lines.
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1631 func Test_diff_scroll_wrap_on()
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1632 20new
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1633 40vsplit
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1634 call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1635 setlocal number diff so=0
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1636 redraw
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1637 normal! jj
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1638 call assert_equal(1, winsaveview().topline)
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1639 normal! j
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1640 call assert_equal(2, winsaveview().topline)
33454
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1641
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1642 bwipe!
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1643 bwipe!
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1644 endfunc
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1645
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1646 func Test_diff_scroll_many_filler()
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1647 20new
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1648 vnew
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1649 call setline(1, ['^^^', '^^^', '$$$', '$$$'])
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1650 diffthis
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1651 setlocal scrolloff=0
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1652 wincmd p
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1653 call setline(1, ['^^^', '^^^'] + repeat(['###'], 41) + ['$$$', '$$$'])
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1654 diffthis
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1655 setlocal scrolloff=0
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1656 wincmd p
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1657 redraw
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1658
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1659 " Note: need a redraw after each scroll, otherwise the test always passes.
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1660 normal! G
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1661 redraw
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1662 call assert_equal(3, winsaveview().topline)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1663 call assert_equal(18, winsaveview().topfill)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1664 exe "normal! \<C-B>"
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1665 redraw
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1666 call assert_equal(3, winsaveview().topline)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1667 call assert_equal(19, winsaveview().topfill)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1668 exe "normal! \<C-B>"
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1669 redraw
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1670 call assert_equal(2, winsaveview().topline)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1671 call assert_equal(0, winsaveview().topfill)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1672 exe "normal! \<C-B>"
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1673 redraw
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1674 call assert_equal(1, winsaveview().topline)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1675 call assert_equal(0, winsaveview().topfill)
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1676
32208
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1677 bwipe!
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1678 bwipe!
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1679 endfunc
73c5881c1793 patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are set
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
1680
29293
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1681 " 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
1682 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
1683 silent! lfile
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1684 set diff
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1685 lopen
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1686 norm o
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1687 silent! norm o
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1688
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1689 set nodiff
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1690 %bwipe!
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1691 endfunc
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1692
29295
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1693 " 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
1694 " 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
1695 " 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
1696 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
1697 set diff
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1698 split 0
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1699 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
1700
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1701 set nodiff
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1702 %bwipe!
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1703 endfunc
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1704
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
1705 " 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
1706 " 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
1707 " 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
1708 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
1709 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
1710 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
1711 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
1712 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
1713
3afe997f4415 patch 9.0.0101: invalid memory access in diff mode with "dp" and undo
Bram Moolenaar <Bram@vim.org>
parents: 29299
diff changeset
1714 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
1715 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
1716 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
1717 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
1718
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1719
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1720 " vim: shiftwidth=2 sts=2 expandtab