annotate src/testdir/test_diffmode.vim @ 34873:1707288c0b15 v9.1.0303

patch 9.1.0303: filetype: some protocol buffer files not recognized Commit: https://github.com/vim/vim/commit/e54a8e7c73bbfba0c77e928f27fb3a9bffd2e8fd Author: Bruno BELANYI <bruno@belanyi.fr> Date: Wed Apr 10 22:34:42 2024 +0200 patch 9.1.0303: filetype: some protocol buffer files not recognized Problem: filetype: some protocol buffer files not recognized Solution: Detect '*.textproto', '*.textpb', '*.txtpb' as pbtxt files (Bruno Belanyi) See: https://protobuf.dev/reference/protobuf/textformat-spec/#text-format-files closes: #14463 Signed-off-by: Bruno BELANYI <bruno@belanyi.fr> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 10 Apr 2024 22:45:04 +0200
parents a93a9b349a5e
children a79acd371fe9
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
34569
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
6 source view_util.vim
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 func Test_diff_fold_sync()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 enew!
14770
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
10 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
11 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
12
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 let l = range(50)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let winone = win_getid()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 new
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let l[25] = 'diff'
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let wintwo = win_getid()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " line 15 is inside the closed fold
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal(19, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call win_gotoid(winone)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal(19, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " open the fold
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 normal zv
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal(-1, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " 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
30 call win_gotoid(wintwo)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal(-1, foldclosedend(10))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " cursor position is in sync
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 normal 23G
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call win_gotoid(winone)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 call assert_equal(23, getcurpos()[1])
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
29299
922b87383277 patch 8.2.5166: test for DiffUpdated fails
Bram Moolenaar <Bram@vim.org>
parents: 29295
diff changeset
38 " 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
39 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
40 au! DiffUpdated
27055ad9276b patch 8.1.0397: no event triggered after updating diffs
Christian Brabandt <cb@256bit.org>
parents: 14762
diff changeset
41
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 windo diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 close!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 set nomodified
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 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
48 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
49 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
50 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
51 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
52
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
53 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
54 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
55 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
56 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
57 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
58
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
59 func Common_vert_split()
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 " 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
61 set notitle noicon
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 new
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 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
64 call setline(1, l)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 w! Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 normal dd
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 $
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 put
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 normal kkrXoxxx
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 w! Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 file Nop
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 normal ggoyyyjjjozzzz
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 set foldmethod=marker foldcolumn=4
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 vert diffsplit Xtest
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 vert diffsplit Xtest2
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call assert_equal(1, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call assert_equal('diff', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call assert_equal(2, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal(1, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(1, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call assert_equal(0, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 let diff_fdm = &fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 let diff_fdc = &fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 " 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
93 diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 " 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
95 " first window
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 wincmd p
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call assert_equal(9, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call assert_equal(1, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 normal gg
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call assert_equal(2, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call assert_equal(3, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 call assert_equal(4, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 call assert_equal(5, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 call assert_equal(6, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 call assert_equal(7, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 normal j
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call assert_equal(8, winline())
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 " Test diffoff
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 diffoff!
29767
2e2f57f2875d patch 9.0.0223: typo in diffmode test
Bram Moolenaar <Bram@vim.org>
parents: 29519
diff changeset
142 1wincmd w
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 let &diff = 1
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 let &fdm = diff_fdm
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 let &fdc = diff_fdc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 4wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 diffoff!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 1wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 wincmd w
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 call assert_equal(0, &diff)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 call assert_equal('marker', &foldmethod)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 call assert_equal(4, &foldcolumn)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 call assert_equal(0, &scrollbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 call assert_equal(0, &cursorbind)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 call assert_equal(1, &wrap)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171
9696
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
172 call delete('Xtest')
103e79a0ad8d commit https://github.com/vim/vim/commit/623cf88f9c5ad49cce8e846af29a1bb9346c7481
Christian Brabandt <cb@256bit.org>
parents: 9694
diff changeset
173 call delete('Xtest2')
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 windo bw!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 endfunc
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 func Test_filler_lines()
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 " Test that diffing shows correct filler lines
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 enew!
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 put =range(4,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 vnew
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 put =range(1,10)
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 1d _
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 windo diffthis
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 wincmd h
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 call assert_equal(1, line('w0'))
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 unlet! diff_fdm diff_fdc
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
189 windo diffoff
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
190 bwipe!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
191 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
192 endfunc
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193
9701
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
194 func Test_diffget_diffput()
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
195 enew!
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
196 let l = range(50)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
197 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
198 call assert_fails('diffget', 'E99:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
199 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
200 call assert_fails('diffget', 'E100:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
201 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
202 let l[10] = 'one'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
203 let l[20] = 'two'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
204 let l[30] = 'three'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
205 let l[40] = 'four'
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
206 call setline(1, l)
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
207 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
208 call assert_equal('one', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
209 11diffget
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
210 call assert_equal('10', getline(11))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
211 21diffput
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
212 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
213 call assert_equal('two', getline(21))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
214 normal 31Gdo
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
215 call assert_equal('three', getline(31))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
216 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
217 normal 41Gdp
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
218 wincmd w
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
219 call assert_equal('40', getline(41))
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
220 new
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
221 diffthis
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
222 call assert_fails('diffget', 'E101:')
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
223
172855211978 commit https://github.com/vim/vim/commit/90d121fa3637b423169c64528efe84a1e67060c9
Christian Brabandt <cb@256bit.org>
parents: 9696
diff changeset
224 windo diffoff
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
225 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
226 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
227
14972
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
228 " 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
229 func Test_diffput_two()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
230 new a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
231 let win_a = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
232 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
233 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
234 new b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
235 let win_b = win_getid()
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
236 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
237 8del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
238 5del
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
239 diffthis
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
240 call win_gotoid(win_a)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
241 %diffput
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
242 call win_gotoid(win_b)
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
243 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
244 bwipe! a
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
245 bwipe! b
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
246 endfunc
5d52b21b2e7f patch 8.1.0497: :%diffput changes order of lines
Bram Moolenaar <Bram@vim.org>
parents: 14893
diff changeset
247
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
248 " 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
249 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
250 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
251 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
252 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
253 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
254 3,5diffget
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
255 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
256 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
257 4,8diffput
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
258 wincmd p
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
259 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
260 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
261 endfunc
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
262
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
263 " 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
264 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
265 %d _
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
266 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
267 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
268 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
269 diffget
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
270 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
271 %d _
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
272 diffput
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
273 wincmd p
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
274 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
275 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
276 endfunc
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
277
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
278 " :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
279 " 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
280 " 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
281 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
282 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
283 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
284 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
285 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
286
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
287 wincmd t
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
288 call assert_equal('Xdiff1', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
289 call feedkeys(":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
290 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
291 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
292 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
293 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
294
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
295 " 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
296 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
297 call assert_equal('Xdiff2', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
298 call feedkeys(":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
299 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
300 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
301 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
302 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
303
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
304 " 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
305 " 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
306 wincmd j
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('Xdiff3', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
308 call assert_equal(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
309 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
310 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
311 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
312 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
313 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
314
19007
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
315 wincmd j
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('Xdiff3', bufname('%'))
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
317 call assert_equal(0, &diff)
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
318 call feedkeys(":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
319 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
320 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
321 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
322 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
323
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
324 wincmd j
0883a37ccf84 patch 8.2.0064: diffmode completion doesn't use per-window setting
Bram Moolenaar <Bram@vim.org>
parents: 18987
diff changeset
325 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
326 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
327 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
328 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
329 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
330 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
331
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
332 %bwipe
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
333 endfunc
e378907d79bf patch 8.2.0054: :diffget and :diffput don't have good completion
Bram Moolenaar <Bram@vim.org>
parents: 18619
diff changeset
334
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
335 func Test_dp_do_buffer()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
336 e! one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
337 let bn1=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
338 let l = range(60)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
339 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
340 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
341
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
342 new two
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
343 let l[10] = 'one'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
344 let l[20] = 'two'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
345 let l[30] = 'three'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
346 let l[40] = 'four'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
347 let l[50] = 'five'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
348 call setline(1, l)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
349 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
350
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
351 " 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
352 11
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
353 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
354 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
355 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
356 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
357
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
358 " 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
359 call assert_equal('one', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
360 exe 'norm ' . bn1 . 'do'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
361 call assert_equal('10', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
362 21
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
363 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
364 diffget one
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
365 call assert_equal('20', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
366
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
367 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
368 exe 'norm ' . bn1 . 'dp'
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
369 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
370 diffput one
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
371 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
372 31
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
373 call assert_equal('three', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
374 41
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
375 call assert_equal('four', getline('.'))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
376
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
377 " 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
378 new not_in_diff_mode
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
379 let bn3=bufnr('%')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
380 wincmd w
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
381 51
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 . "dp"', 'E103:')
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
383 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
384 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
385 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
386
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
387 windo diffoff
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
388 %bwipe!
9694
5e9f63a2ac5c commit https://github.com/vim/vim/commit/42093c0ec52e6ff29e80aae65ac6a744c7de79bb
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389 endfunc
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
390
14893
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
391 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
392 e! one
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
393 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
394 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
395
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
396 new two
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
397 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
398 diffthis
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
399
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
400 1
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 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
403 wincmd w
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
404 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
405 norm G
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
406 norm do
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
407 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
408
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
409 windo diffoff
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
410 %bwipe!
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
411 endfunc
291656f731c9 patch 8.1.0458: ml_get error and crash when using "do"
Bram Moolenaar <Bram@vim.org>
parents: 14873
diff changeset
412
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
413 func Test_diffoff()
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
414 enew!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
415 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
416 redraw
10005
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
417 let normattr = screenattr(1, 1)
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
418 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
419 botright vert new
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
420 call setline(1, ['One', '', 'Two', 'Three'])
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
421 diffthis
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
422 redraw
17994
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17837
diff changeset
423 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
424 diffoff!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
425 redraw
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
426 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
427 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
428 bwipe!
4b4ba6589a98 commit https://github.com/vim/vim/commit/e67d546f3c691139e6d3d33f36724d98aec04c14
Christian Brabandt <cb@256bit.org>
parents: 9701
diff changeset
429 endfunc
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
430
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
431 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
432 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
433 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
434 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
435 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
436 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
437
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
438 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
439 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
440 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
441
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
442 redraw
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(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
444 call assert_equal(normattr, screenattr(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
445 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
446 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
447
12315
40ee9f3d265f patch 8.0.1037: "icase" of 'diffopt' is not used for highlighting
Christian Brabandt <cb@256bit.org>
parents: 11430
diff changeset
448 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
449 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
450 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
451
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
452 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
453 %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
454 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
455
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
456 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
457 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
458 call Common_icase_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
459 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
460 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
461
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
462 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
463 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
464 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
465 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
466 endfunc
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
467
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
468 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
469 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
470 " 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
471 " 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
472 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
473 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
474 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
475 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
476
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
477 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
478 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
479 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
480
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
481 redraw
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(1, 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(2, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
484 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
485 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
486 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
487 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
488
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
489 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
490 %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
491 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
492
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
493 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
494 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
495 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
496 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
497 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
498
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
499 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
500 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
501 call Common_iwhite_test()
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
502 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
503 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
504
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
505 func Test_diffopt_context()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
506 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
507 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
508 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
509 new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
510 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
511 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
512
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
513 set diffopt=context:2
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
514 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
515 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
516 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
517
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
518 set diffopt=context:1
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
519 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
520 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
521 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
522
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
523 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
524 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
525 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
526 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
527
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
528 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
529 set diffopt=internal,horizontal
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
530 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
531
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(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
533 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
534 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
535 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
536
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
537 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
538 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
539 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
540 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
541
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
542 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
543 set diffopt=internal,vertical
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
544 diffsplit
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
545
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(1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
547 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
548 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
549 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
550
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
551 set diffopt&
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
552 diffoff!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
553 %bwipe
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
554 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
555
12971
ca3cb1997f08 patch 8.0.1361: some users don't want to diff with hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
556 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
557 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
558 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
559 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
560 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
561 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
562 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
563 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
564 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
565 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
566 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
567 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
568 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
569 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
570 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
571 " 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
572 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
573
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 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
576 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
577 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
578
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
579 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
580 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
581 e! one
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
582 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
583 redraw
10821
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
584 let normattr = screenattr(1, 1)
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
585 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
586 botright vert new two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
587 call setline(1, ['One', 'Four'])
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
588 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
589 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
590 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
591 set hidden
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
592 close
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
593 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
594 " diffing with hidden buffer two
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
595 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
596 diffoff
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
597 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
598 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
599 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
600 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
601 " 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
602 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
603 diffoff!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
604 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
605 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
606 diffthis
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
607 redraw
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
608 " 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
609 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
610
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 bwipe!
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
613 set hidden& diffopt&
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
614 endfunc
d9e48fb5142f patch 8.0.0300: cannot stop diffing hidden buffers
Christian Brabandt <cb@256bit.org>
parents: 10295
diff changeset
615
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
616 func Test_setting_cursor()
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
617 new Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
618 put =range(1,90)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
619 wq
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
620 new Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
621 put =range(1,100)
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
622 wq
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
623
10295
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
624 tabe Xtest2
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
625 $
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
626 diffsp Xtest1
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
627 tabclose
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
628
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
629 call delete('Xtest1')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
630 call delete('Xtest2')
d0b74b18e4b5 commit https://github.com/vim/vim/commit/025e3e0bafbc85cc4e365145af711edf99d0a90d
Christian Brabandt <cb@256bit.org>
parents: 10005
diff changeset
631 endfunc
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
632
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
633 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
634 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
635 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
636 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
637 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
638 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
639 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
640 norm ]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
641 call assert_equal(2, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
642 norm 3]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
643 call assert_equal(9, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
644 norm 10]c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
645 call assert_equal(11, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
646 norm [c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
647 call assert_equal(9, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
648 norm 2[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
649 call assert_equal(5, line('.'))
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
650 norm 10[c
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
651 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
652 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
653 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
654
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
655 func Test_diffexpr()
23027
f74978697fb6 patch 8.2.2060: check for features implemented with "if"
Bram Moolenaar <Bram@vim.org>
parents: 22818
diff changeset
656 CheckExecutable diff
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
657
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
658 func DiffExpr()
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
659 " 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
660 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
661 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
662 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
663 set diffexpr=DiffExpr()
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
664 set diffopt=foldcolumn:0
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
665
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
666 enew!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
667 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
668 redraw
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
669 let normattr = screenattr(1, 1)
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
670 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
671
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
672 botright vert new
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
673 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
674 diffthis
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
675
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
676 redraw
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(1, 1))
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
678 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
679 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
680 diffoff!
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
681
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 26044
diff changeset
682 " 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
683 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
684 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
685 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
686
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 " 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
688 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
689 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
690 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
691 call assert_equal(expand('<SID>') .. 'NewDiffExpr()', &diffexpr)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
692 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
693 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
694
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
695 %bwipe!
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
696 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
697 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
698 delfunc s:NewDiffExpr
11430
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
699 endfunc
eba1a8c6e21d patch 8.0.0599: diff mode is insufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 11113
diff changeset
700
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
701 func Test_diffpatch()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
702 " 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
703 CheckExecutable patch
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21321
diff changeset
704 CheckUnix
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
705 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
706 insert
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
707 ***************
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
708 *** 1,3 ****
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
709 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
710 ! 2
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
711 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
712 --- 1,4 ----
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
713 1
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
714 ! 2x
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
715 3
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
716 + 4
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
717 .
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
718 saveas! Xpatch
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
719 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
720 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
721 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
722
11113
081ed9efb5c0 patch 8.0.0444: diffpatch fails when the file name has a quote
Christian Brabandt <cb@256bit.org>
parents: 11109
diff changeset
723 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
724 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
725 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
726 call rename('Xpatch', name)
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
727 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
728 exe 'diffpatch ' . escape(name, '$')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
729 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
730 if name != 'Xpatch'
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
731 call rename(name, 'Xpatch')
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
732 endif
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
733 bwipe!
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
734 endfor
0adcfcf22036 patch 8.0.0442: patch shell command not well escaped
Christian Brabandt <cb@256bit.org>
parents: 11091
diff changeset
735
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
736 call delete('Xpatch')
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
737 bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
738 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
739
32218
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
740 " 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
741 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
742 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
743 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
744
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
745 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
746 qa!
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
747 END
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
748 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
749 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
750 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
751 endif
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
752 call delete('Xresult')
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
753 endfunc
9c6bc59b6d80 patch 9.0.1440: "rvim" can execute a shell through :diffpatch
Bram Moolenaar <Bram@vim.org>
parents: 32208
diff changeset
754
10984
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
755 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
756 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
757 exe "new Xtest" . i
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
758 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
759 endfor
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
760 new Xtest9
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
761 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
762 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
763 endfunc
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
764
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
765 func Test_diff_nomodifiable()
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
766 new
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
767 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
768 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
769 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
770 vnew
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
771 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
772 diffthis
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
773 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
774 setl nomodifiable
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
775 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
776 %bwipe!
c0d5e8ab1452 patch 8.0.0381: diff mode is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10821
diff changeset
777 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
778
12549
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
779 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
780 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
781 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
782 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
783 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
784 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
785 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
786 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
787
17624
4c7097a980a5 patch 8.1.1809: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 17614
diff changeset
788 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
789
17624
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, 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
791 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
792 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
793 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
794 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
795
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
796 wincmd w
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(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
798 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
799 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
800
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
801 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
802 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
803
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
804 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
805 new
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
806 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
807 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
808 vnew
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
809 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
810 diffthis
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
811 redraw
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
812
17837
f71ee7b04f0b patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17624
diff changeset
813 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
814 wincmd w
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
815 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
816
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
817 %bwipe!
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
818 endfunc
62e8cef76508 patch 8.0.1153: no tests for diff_hlID() and diff_filler()
Christian Brabandt <cb@256bit.org>
parents: 12315
diff changeset
819
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
820 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
821 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
822 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
823 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
824 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
825 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
826 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
827 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
828 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
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 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
831 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
832 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
833 $
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 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
835 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
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 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
838 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
839
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
840 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
841 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
842 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
843 if a:buf
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
844 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
845 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
846 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
847
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
848 " 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
849 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
850 " 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
851 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
852 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
853 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
854 " 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
855 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
856 endif
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
857 endfor
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
858
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
859 " also test unified diff
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
860 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
861 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
862 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
863 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
864 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
865
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
866 " 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
867 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
868 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
869 " 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
870 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
871 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
872 endfunc
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
873
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
874 func Test_diff_screen()
34349
835fc06c4547 patch 9.1.0107: CI: Fix MacOS-14 tests
Christian Brabandt <cb@256bit.org>
parents: 34340
diff changeset
875 if has('osxdarwin') && system('diff --version') =~ '^Apple diff'
835fc06c4547 patch 9.1.0107: CI: Fix MacOS-14 tests
Christian Brabandt <cb@256bit.org>
parents: 34340
diff changeset
876 throw 'Skipped: unified diff does not work properly on this macOS version'
34259
70c1a9c6f41d patch 9.1.0070: CI: testsuite not run on M1 Mac
Christian Brabandt <cb@256bit.org>
parents: 33884
diff changeset
877 endif
70c1a9c6f41d patch 9.1.0070: CI: testsuite not run on M1 Mac
Christian Brabandt <cb@256bit.org>
parents: 33884
diff changeset
878
25969
a5a772dace5b patch 8.2.3518: Test_xrestore sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 25717
diff changeset
879 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
880 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
881 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
882
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
883 let lines =<< trim END
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
884 func UnifiedDiffExpr()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
885 " 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
886 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
887 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
888 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
889 func SetupUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
890 set diffexpr=UnifiedDiffExpr()
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
891 diffupdate
24661
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
892 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
893 func StopUnified()
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
894 set diffexpr=
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
895 endfunc
f51ea1b6d512 patch 8.2.2869: using unified diff is not tested
Bram Moolenaar <Bram@vim.org>
parents: 23895
diff changeset
896 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
897 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
898
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
899 " 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
900 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
901 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
902
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
903 " Test 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
904 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
905 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
906 " 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
907 " files
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
908 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
909
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
910 call VerifyBoth(buf, 'Test_diff_01', '')
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
911
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
912 " 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
913 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
914 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
915
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
916 " 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
917 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
918 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
919
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
920 " 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
921 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
922 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
923
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
924 " 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
925 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
926 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
927
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
928 " 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
929 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
930 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
931
15900
360c93a884d0 patch 8.1.0956: using context:0 in 'diffopt' does not work well
Bram Moolenaar <Bram@vim.org>
parents: 15103
diff changeset
932 " 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
933 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
934 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
935 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
936 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
937 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
938 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
939 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
940 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
941 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
942
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
943 " Test 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
944 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
945 \ ' 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
946 \ ' 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
947 \ ' 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
948 \ '{', ' 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
949 \ ['#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
950 \ ' 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
951 \ '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
952 \ ' 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
953 \ '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
954 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
955 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
956 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
957
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 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
959 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
960
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 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
962 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
963
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
964 " Test 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
965 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
966 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
967 \ ['', ' 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
968 \ ' 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
969 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
970 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
971 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
972
15103
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
973 " Leave trailing : at commandline!
9339601e7a31 patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Bram Moolenaar <Bram@vim.org>
parents: 14984
diff changeset
974 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
975 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
976 " 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
977 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
978 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
979 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
980 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
981 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
982 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
983
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
984 " 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
985 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
986 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
987
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
988 " 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
989 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
990 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
991
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
992 " 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
993 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
994 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
995
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
996 " 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
997 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
998 \ ['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
999 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
1000 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
1001 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
1002 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
1003 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
1004
14762
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1005 " 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
1006 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
1007 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
1008
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1009 " 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
1010 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
1011 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
1012 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
1013
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1014 " 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
1015 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
1016 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
1017
b43ea03bb522 patch 8.1.0393: not all white space difference options available
Christian Brabandt <cb@256bit.org>
parents: 14726
diff changeset
1018 " 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
1019 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
1020
14696
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1021 " 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
1022 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
1023 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
1024 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
1025 endfunc
195e8b1fcbbf patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents: 12971
diff changeset
1026
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
1027 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
1028 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
1029
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 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
1031 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
1032 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
1033 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
1034 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
1035 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
1036 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
1037 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1038 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
1039 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
1040
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 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
1042
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 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
1044 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
1045
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
1046 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
1047 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
1048
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
1049 " 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
1050 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
1051 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
1052
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1053 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
1054 CheckScreendump
14873
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1055
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1056 call writefile([
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1057 \ '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
1058 \ 'set cursorline',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1059 \ '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
1060 \ 'vnew',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1061 \ '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
1062 \ 'windo diffthis',
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1063 \ '2wincmd w',
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1064 \ ], '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
1065 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
1066
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1067 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
1068 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
1069 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
1070 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
1071 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
1072
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1073 " clean up
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1074 call StopVimInTerminal(buf)
a8ed1cb85859 patch 8.1.0448: cursorline not removed when using 'cursorbind'
Christian Brabandt <cb@256bit.org>
parents: 14770
diff changeset
1075 endfunc
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1076
27990
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1077 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
1078 CheckScreendump
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1079
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1080 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
1081 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
1082 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
1083 set cursorline number
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1084 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
1085 2
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1086 vnew
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1087 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
1088 windo diffthis
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1089 1wincmd w
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1090 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1091 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
1092 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
1093
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1094 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
1095 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
1096 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
1097
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1098 " clean up
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1099 call StopVimInTerminal(buf)
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1100 endfunc
27ae8ea82d7a patch 8.2.4520: using wrong highlight for cursor line number
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
1101
25517
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1102 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
1103 CheckScreendump
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1104
33884
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1105 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
1106 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
1107 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
1108 50vnew
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1109 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
1110 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
1111 vnew
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1112 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
1113 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
1114 windo diffthis
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1115 2wincmd w
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1116 END
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1117 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
1118 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
1119
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1120 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
1121 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
1122 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
1123 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
1124 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
1125 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
1126 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
1127 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
1128
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1129 " clean up
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1130 call StopVimInTerminal(buf)
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1131 endfunc
b04e76e66128 patch 8.2.3295: 'cursorline' should not apply to 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 24870
diff changeset
1132
33884
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1133 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
1134 CheckScreendump
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1135
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1136 let lines =<< trim END
34340
29a814bbb630 patch 9.1.0103: 'breakindentopt' "min" not correct with 'signcolumn'
Christian Brabandt <cb@256bit.org>
parents: 34332
diff changeset
1137 set laststatus=0 diffopt+=followwrap breakindent breakindentopt=min:0
33884
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1138 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
1139 vnew
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1140 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
1141 windo diffthis
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1142 norm! G$
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1143 END
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1144 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
1145 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
1146 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
1147
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1148 " clean up
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1149 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
1150 endfunc
3d0544e31ca5 patch 9.0.2151: 'breakindent' is not drawn after diff filler lines
Christian Brabandt <cb@256bit.org>
parents: 33454
diff changeset
1151
18092
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1152 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
1153 CheckScreendump
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1154
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1155 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
1156 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
1157 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
1158 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
1159 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1160 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1161 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1162 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
1163 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
1164 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
1165 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
1166 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
1167 return 5;
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1168 }
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1169 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1170 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
1171
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1172 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
1173 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
1174 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
1175 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1176 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
1177 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
1178
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1179 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
1180
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1181 " clean up
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1182 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
1183 endfunc
995925603ea0 patch 8.1.2041: no test for diff mode with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
1184
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1185 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
1186 CheckScreendump
d7708560b77c patch 8.1.1804: no test for display updating without a scroll region
Bram Moolenaar <Bram@vim.org>
parents: 17385
diff changeset
1187 CheckFeature rightleft
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1188
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1189 call writefile([
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1190 \ '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
1191 \ 'vnew',
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1192 \ '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
1193 \ '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
1194 \ '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
1195 \ 'setlocal number',
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1196 \ ], 'Xtest_diff_diff', 'D')
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1197 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
1198
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1199 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
1200
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
1201 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
1202 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
1203
14984
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1204 " clean up
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1205 call StopVimInTerminal(buf)
28fde4aa8534 patch 8.1.0503: missing change to diff test
Bram Moolenaar <Bram@vim.org>
parents: 14972
diff changeset
1206 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
1207
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1208 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
1209 enew
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1210 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
1211 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1212 new
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1213 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
1214 diffthis
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1215 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
1216 only!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1217 endfunc
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1218
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1219 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
1220 " "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
1221 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
1222 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
1223 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1224
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1225 " "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
1226 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
1227 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
1228 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
1229 diffoff!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1230 enew!
41484f342f80 patch 8.1.2289: after :diffsplit closing the window does not disable diff
Bram Moolenaar <Bram@vim.org>
parents: 18092
diff changeset
1231 endfunc
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1232
23895
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1233 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
1234 new
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 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
1236 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
1237 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1238 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
1239 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1240 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
1241 diffthis
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1242 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
1243 diffoff
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1244 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
1245 bwipe!
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1246 endfunc
e313b6ee2d9c patch 8.2.2490: 'wrap' option is always reset when starting diff mode
Bram Moolenaar <Bram@vim.org>
parents: 23027
diff changeset
1247
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1248 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
1249 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
1250 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
1251 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
1252 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
1253 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
1254 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
1255 " 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
1256 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
1257 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
1258 " 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
1259 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
1260 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
1261 " 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
1262 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
1263 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
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 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
1266 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
1267
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 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
1269 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
1270 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
1271 call DiffMaintainsChangeMark()
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1272
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
1273 set diffopt&
27167
391eb1c30344 patch 8.2.4112: function not deleted at end of test
Bram Moolenaar <Bram@vim.org>
parents: 26815
diff changeset
1274 delfunc DiffMaintainsChangeMark
18619
788d76db02ac patch 8.1.2302: :lockmarks does not work for '[ and ']
Bram Moolenaar <Bram@vim.org>
parents: 18590
diff changeset
1275 endfunc
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1276
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1277 " Test for 'patchexpr'
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1278 func Test_patchexpr()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1279 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
1280 func TPatch()
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_in))
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1282 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
1283 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
1284 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1285 set patchexpr=TPatch()
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1286
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1287 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
1288 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
1289 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1290 edit Xinput
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1291 diffpatch Xdiff
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('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
1293 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
1294 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
1295 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
1296
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
1297 " 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
1298 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
1299 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
1300 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
1301 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
1302 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
1303 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
1304
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1305 set patchexpr&
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1306 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
1307 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
1308 %bwipe!
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1309 endfunc
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
1310
20905
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1311 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
1312 CheckScreendump
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1313
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1314 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
1315 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
1316 vnew
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1317 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
1318 windo diffthis
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1319 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
1320 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1321 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
1322 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
1323
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1324 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
1325
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1326 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
1327 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
1328 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
1329 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
1330
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1331 " clean up
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1332 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
1333 endfunc
802bf80bcfe4 patch 8.2.1004: line numbers below filler lines not always updated
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1334
21014
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1335 func Test_diff_multilineconceal()
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1336 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1337 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1338
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1339 new
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1340 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
1341 set cole=2 cocu=n
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1342 call setline(1, ["a", "b"])
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1343 diffthis
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1344 redraw
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1345 endfunc
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 20905
diff changeset
1346
21321
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1347 func Test_diff_and_scroll()
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1348 " 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
1349 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
1350 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
1351 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
1352 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1353 vnew
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 30379
diff changeset
1354 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
1355 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
1356 endfor
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1357 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1358 wincmd p
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1359 diffthis
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1360 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
1361
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 bwipe!
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1364 set ls&
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1365 endfunc
1421eca61db9 patch 8.2.1211: removed more than dead code
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
1366
22818
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1367 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
1368 CheckScreendump
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1369
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1370 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
1371 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
1372 vnew
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1373 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
1374 windo diffthis
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1375 wincmd p
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1376 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
1377 norm! gg0
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1378 redraw!
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1379 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1380 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
1381 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
1382
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1383 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
1384
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, "l")
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1386 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
1387 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
1388 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
1389 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
1390 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
1391 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
1392 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
1393 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
1394
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1395 " clean up
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1396 call StopVimInTerminal(buf)
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1397 endfunc
b27601c0d289 patch 8.2.1957: diff and cursorcolumn highlighting don't mix
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1398
24870
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1399 " 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
1400 " 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
1401 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
1402 enew!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1403 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
1404 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
1405 new
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1406 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
1407 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
1408 windo diffthis
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1409
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1410 " 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
1411 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
1412 5d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1413 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1414 call 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
1415
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1416 " 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
1417 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
1418 normal! 4Goe
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1419 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
1420 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
1421 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
1422
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1423 " 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
1424 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
1425 7,8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1426 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1427 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1428 call assert_equal(['', 'DiffText', 'DiffText', '', '', '', 'DiffAdd',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1429 \ 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1430
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1431 " remove lines 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
1432 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1433 call setline(1, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'])
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1434 2,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1435 call win_gotoid(w1_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1436 let hl = range(1, 9)->map({_, lnum -> diff_hlID(lnum, 1)->synIDattr('name')})
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1437 call assert_equal(['', 'DiffText', 'DiffText', 'DiffAdd', 'DiffAdd',
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1438 \ 'DiffAdd', 'DiffAdd', 'DiffAdd', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1439
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1440 " 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
1441 call win_gotoid(w2_id)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1442 call setline(1, ['a', '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
1443 5,6d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1444 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
1445 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
1446 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
1447 \ '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
1448
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1449 " 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
1450 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
1451 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
1452 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1453 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
1454 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
1455 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
1456 \ 'DiffText', ''], hl)
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1457
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1458 " 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
1459 " 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
1460 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
1461 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
1462 4,7d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1463 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
1464 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
1465 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
1466 \ '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
1467
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1468 " 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
1469 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
1470 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
1471 8d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1472 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
1473 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
1474 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
1475 4d
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1476 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
1477 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
1478 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
1479
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1480 %bw!
13812db714fa patch 8.2.2973: fix for recovery and diff mode not tested
Bram Moolenaar <Bram@vim.org>
parents: 24683
diff changeset
1481 endfunc
24683
05c199ea8295 patch 8.2.2880: unified diff fails if actually used
Bram Moolenaar <Bram@vim.org>
parents: 24661
diff changeset
1482
26794
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1483 func Test_diff_binary()
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1484 CheckScreendump
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1485
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1486 let content =<< trim END
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1487 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
1488 vnew
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1489 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
1490 windo diffthis
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1491 wincmd p
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1492 norm! gg0
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1493 redraw!
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1494 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1495 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
1496 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
1497
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1498 " Test using internal diff
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1499 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
1500
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1501 " 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
1502 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
1503 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
1504 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
1505 " Test using external diff
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, ":set diffopt=filler\<cr>")
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1507 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
1508 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
1509 " 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
1510 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
1511 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
1512 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
1513
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1514 " clean up
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1515 call StopVimInTerminal(buf)
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1516 set diffopt&vim
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1517 endfunc
83a99f08d1e8 patch 8.2.3925: diff mode confused by NUL bytes
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1518
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1519 " 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
1520 " 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
1521 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
1522 %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
1523 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
1524 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
1525 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
1526 windo diffthis
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1527 " 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
1528 botright new
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1529 1wincmd w
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(1, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1531 call assert_true(getwinvar(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1532 call assert_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
1533 normal zi
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(1, '&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(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1536 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
1537 normal zi
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(1, '&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(2, '&foldenable'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1540 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
1541
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1542 " 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
1543 " '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
1544 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1545 set noscrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1546 normal zi
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_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
1548 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
1549 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
1550
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1551 " '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
1552 1wincmd w
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1553 set scrollbind
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1554 normal zi
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1555 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
1556 normal zi
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_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
1558 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
1559 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
1560
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1561 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1562 set scrollbind&
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1563 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 27167
diff changeset
1564
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1565 " 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
1566 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
1567 CheckScreendump
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1568
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1569 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
1570 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
1571 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
1572 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
1573 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
1574
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1575 // 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
1576 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1577 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1578 // 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
1579
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1580 // Common block
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1581 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1582 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1583 // four lines
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1584 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1585 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
1586 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
1587 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
1588 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
1589 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
1590 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
1591
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1592 Lorem
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1593 ipsum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1594 dolor
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1595 sit
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1596 amet,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1597 consectetur
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1598 adipiscing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1599 elit.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1600 Etiam
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1601 luctus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1602 lectus
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1603 sodales,
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1604 dictum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1605
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1606 // 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
1607 // one
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1608 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1609 // 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
1610
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1611 Vestibulum
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1612 tincidunt
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1613 aliquet
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1614 nulla.
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1615
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1616 // 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
1617 // two
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1618 // containing
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1619 // 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
1620 END
30379
25e3121ed316 patch 9.0.0525: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29997
diff changeset
1621 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
1622 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
1623 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
1624 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
1625 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
1626 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
1627
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1628 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
1629 endfunc
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1630
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
1631 " 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
1632 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
1633 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
1634 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
1635 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
1636 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
1637 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
1638 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
1639 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
1640 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
1641 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
1642
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 bwipe!
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1645 endfunc
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1646
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1647 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
1648 20new
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1649 vnew
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1650 call setline(1, range(1, 40))
33454
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1651 diffthis
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1652 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
1653 wincmd p
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1654 call setline(1, range(1, 20)->reverse() + ['###']->repeat(41) + range(21, 40)->reverse())
33454
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1655 diffthis
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1656 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
1657 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
1658 redraw
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1659
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1660 " Note: need a redraw after each scroll, otherwise the test always passes.
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1661 for _ in range(2)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1662 normal! G
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1663 redraw
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1664 call assert_equal(40, winsaveview().topline)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1665 call assert_equal(19, winsaveview().topfill)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1666 exe "normal! \<C-B>"
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1667 redraw
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1668 call assert_equal(22, winsaveview().topline)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1669 call assert_equal(0, winsaveview().topfill)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1670 exe "normal! \<C-B>"
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1671 redraw
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1672 call assert_equal(4, winsaveview().topline)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1673 call assert_equal(0, winsaveview().topfill)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1674 exe "normal! \<C-B>"
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1675 redraw
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1676 call assert_equal(1, winsaveview().topline)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1677 call assert_equal(0, winsaveview().topfill)
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1678 set smoothscroll
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1679 endfor
33454
b91aeab2d62e patch 9.0.1981: not being able to scroll up in diff mode
Christian Brabandt <cb@256bit.org>
parents: 32218
diff changeset
1680
34653
8079960136db patch 9.1.0211: page-wise scrolling does not support smooth-scrolling
Christian Brabandt <cb@256bit.org>
parents: 34569
diff changeset
1681 set smoothscroll&
34761
b20609f4ab37 patch 9.1.0258: half-page scrolling broke backward compatibility
Christian Brabandt <cb@256bit.org>
parents: 34653
diff changeset
1682 %bwipe!
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
1683 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
1684
29293
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1685 " 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
1686 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
1687 silent! lfile
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1688 set diff
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1689 lopen
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1690 norm o
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1691 silent! norm o
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1692
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1693 set nodiff
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1694 %bwipe!
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1695 endfunc
bf4d7898cf93 patch 8.2.5163: crash when deleting buffers in diff mode
Bram Moolenaar <Bram@vim.org>
parents: 29275
diff changeset
1696
29295
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1697 " 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
1698 " 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
1699 " 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
1700 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
1701 set diff
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1702 split 0
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1703 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
1704
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1705 set nodiff
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1706 %bwipe!
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1707 endfunc
92dd6fef5ace patch 8.2.5164: invalid memory access after diff buffer manipulations
Bram Moolenaar <Bram@vim.org>
parents: 29293
diff changeset
1708
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
1709 " 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
1710 " 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
1711 " 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
1712 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
1713 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
1714 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
1715 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
1716 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
1717
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 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
1719 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
1720 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
1721 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
1722
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1723 " Test for the diff() function
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1724 def Test_diff_func()
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1725 # string is added/removed/modified at the beginning
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1726 assert_equal("@@ -0,0 +1 @@\n+abc\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1727 diff(['def'], ['abc', 'def'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1728 assert_equal([{from_idx: 0, from_count: 0, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1729 diff(['def'], ['abc', 'def'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1730 assert_equal("@@ -1 +0,0 @@\n-abc\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1731 diff(['abc', 'def'], ['def'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1732 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 0}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1733 diff(['abc', 'def'], ['def'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1734 assert_equal("@@ -1 +1 @@\n-abc\n+abx\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1735 diff(['abc', 'def'], ['abx', 'def'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1736 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1737 diff(['abc', 'def'], ['abx', 'def'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1738
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1739 # string is added/removed/modified at the end
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1740 assert_equal("@@ -1,0 +2 @@\n+def\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1741 diff(['abc'], ['abc', 'def'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1742 assert_equal([{from_idx: 1, from_count: 0, to_idx: 1, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1743 diff(['abc'], ['abc', 'def'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1744 assert_equal("@@ -2 +1,0 @@\n-def\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1745 diff(['abc', 'def'], ['abc'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1746 assert_equal([{from_idx: 1, from_count: 1, to_idx: 1, to_count: 0}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1747 diff(['abc', 'def'], ['abc'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1748 assert_equal("@@ -2 +2 @@\n-def\n+xef\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1749 diff(['abc', 'def'], ['abc', 'xef'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1750 assert_equal([{from_idx: 1, from_count: 1, to_idx: 1, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1751 diff(['abc', 'def'], ['abc', 'xef'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1752
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1753 # string is added/removed/modified in the middle
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1754 assert_equal("@@ -2,0 +3 @@\n+xxx\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1755 diff(['111', '222', '333'], ['111', '222', 'xxx', '333'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1756 assert_equal([{from_idx: 2, from_count: 0, to_idx: 2, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1757 diff(['111', '222', '333'], ['111', '222', 'xxx', '333'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1758 assert_equal("@@ -3 +2,0 @@\n-333\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1759 diff(['111', '222', '333', '444'], ['111', '222', '444'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1760 assert_equal([{from_idx: 2, from_count: 1, to_idx: 2, to_count: 0}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1761 diff(['111', '222', '333', '444'], ['111', '222', '444'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1762 assert_equal("@@ -3 +3 @@\n-333\n+xxx\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1763 diff(['111', '222', '333', '444'], ['111', '222', 'xxx', '444'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1764 assert_equal([{from_idx: 2, from_count: 1, to_idx: 2, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1765 diff(['111', '222', '333', '444'], ['111', '222', 'xxx', '444'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1766
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1767 # new strings are added to an empty List
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1768 assert_equal("@@ -0,0 +1,2 @@\n+abc\n+def\n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1769 diff([], ['abc', 'def'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1770 assert_equal([{from_idx: 0, from_count: 0, to_idx: 0, to_count: 2}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1771 diff([], ['abc', 'def'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1772
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1773 # all the strings are removed from a List
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1774 assert_equal("@@ -1,2 +0,0 @@\n-abc\n-def\n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1775 diff(['abc', 'def'], [], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1776 assert_equal([{from_idx: 0, from_count: 2, to_idx: 0, to_count: 0}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1777 diff(['abc', 'def'], [], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1778
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1779 # First character is added/removed/different
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1780 assert_equal("@@ -1 +1 @@\n-abc\n+bc\n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1781 diff(['abc'], ['bc'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1782 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1783 diff(['abc'], ['bc'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1784 assert_equal("@@ -1 +1 @@\n-bc\n+abc\n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1785 diff(['bc'], ['abc'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1786 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1787 diff(['bc'], ['abc'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1788 assert_equal("@@ -1 +1 @@\n-abc\n+xbc\n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1789 diff(['abc'], ['xbc'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1790 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1791 diff(['abc'], ['xbc'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1792
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1793 # Last character is added/removed/different
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1794 assert_equal("@@ -1 +1 @@\n-abc\n+abcd\n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1795 diff(['abc'], ['abcd'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1796 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1797 diff(['abc'], ['abcd'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1798 assert_equal("@@ -1 +1 @@\n-abcd\n+abc\n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1799 diff(['abcd'], ['abc'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1800 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1801 diff(['abcd'], ['abc'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1802 var diff_unified: string = diff(['abc'], ['abx'], {output: 'unified'})
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1803 assert_equal("@@ -1 +1 @@\n-abc\n+abx\n", diff_unified)
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1804 var diff_indices: list<dict<number>> =
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1805 diff(['abc'], ['abx'], {output: 'indices'})
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1806 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1807 diff_indices)
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1808
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1809 # partial string modification at the start and at the end.
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1810 var fromlist =<< trim END
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1811 one two
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1812 three four
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1813 five six
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1814 END
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1815 var tolist =<< trim END
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1816 one
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1817 six
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1818 END
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1819 assert_equal("@@ -1,3 +1,2 @@\n-one two\n-three four\n-five six\n+one\n+six\n", diff(fromlist, tolist, {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1820 assert_equal([{from_idx: 0, from_count: 3, to_idx: 0, to_count: 2}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1821 diff(fromlist, tolist, {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1822
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1823 # non-contiguous modifications
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1824 fromlist =<< trim END
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1825 one two
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1826 three four
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1827 five abc six
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1828 END
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1829 tolist =<< trim END
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1830 one abc two
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1831 three four
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1832 five six
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1833 END
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1834 assert_equal("@@ -1 +1 @@\n-one two\n+one abc two\n@@ -3 +3 @@\n-five abc six\n+five six\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1835 diff(fromlist, tolist, {output: 'unified'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1836 assert_equal([{'from_count': 1, 'to_idx': 0, 'to_count': 1, 'from_idx': 0},
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1837 {'from_count': 1, 'to_idx': 2, 'to_count': 1, 'from_idx': 2}],
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1838 diff(fromlist, tolist, {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1839
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1840 # add/remove blank lines
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1841 assert_equal("@@ -2,2 +1,0 @@\n-\n-\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1842 diff(['one', '', '', 'two'], ['one', 'two'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1843 assert_equal([{from_idx: 1, from_count: 2, to_idx: 1, to_count: 0}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1844 diff(['one', '', '', 'two'], ['one', 'two'], {output: 'indices'}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1845 assert_equal("@@ -1,0 +2,2 @@\n+\n+\n",
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1846 diff(['one', 'two'], ['one', '', '', 'two'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1847 assert_equal([{'from_idx': 1, 'from_count': 0, 'to_idx': 1, 'to_count': 2}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1848 diff(['one', 'two'], ['one', '', '', 'two'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1849
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1850 # diff ignoring case
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1851 assert_equal('', diff(['abc', 'def'], ['ABC', 'DEF'], {icase: true, output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1852 assert_equal([], diff(['abc', 'def'], ['ABC', 'DEF'], {icase: true, output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1853
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1854 # diff ignoring all whitespace changes except leading whitespace changes
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1855 assert_equal('', diff(['abc def'], ['abc def '], {iwhite: true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1856 assert_equal("@@ -1 +1 @@\n- abc\n+ xxx\n", diff([' abc'], [' xxx'], {iwhite: v:true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1857 assert_equal("@@ -1 +1 @@\n- abc\n+ xxx\n", diff([' abc'], [' xxx'], {iwhite: v:false}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1858 assert_equal("@@ -1 +1 @@\n-abc \n+xxx \n", diff(['abc '], ['xxx '], {iwhite: v:true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1859 assert_equal("@@ -1 +1 @@\n-abc \n+xxx \n", diff(['abc '], ['xxx '], {iwhite: v:false}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1860
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1861 # diff ignoring all whitespace changes
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1862 assert_equal('', diff(['abc def'], [' abc def '], {iwhiteall: true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1863 assert_equal("@@ -1 +1 @@\n- abc \n+ xxx \n", diff([' abc '], [' xxx '], {iwhiteall: v:true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1864 assert_equal("@@ -1 +1 @@\n- abc \n+ xxx \n", diff([' abc '], [' xxx '], {iwhiteall: v:false}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1865
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1866 # diff ignoring trailing whitespace changes
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1867 assert_equal('', diff(['abc'], ['abc '], {iwhiteeol: true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1868
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1869 # diff ignoring blank lines
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1870 assert_equal('', diff(['one', '', '', 'two'], ['one', 'two'], {iblank: true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1871 assert_equal('', diff(['one', 'two'], ['one', '', '', 'two'], {iblank: true}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1872
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1873 # same string
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1874 assert_equal('', diff(['abc', 'def', 'ghi'], ['abc', 'def', 'ghi']))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1875 assert_equal('', diff([''], ['']))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1876 assert_equal('', diff([], []))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1877
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1878 # different xdiff algorithms
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1879 for algo in ['myers', 'minimal', 'patience', 'histogram']
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1880 assert_equal("@@ -1 +1 @@\n- abc \n+ xxx \n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1881 diff([' abc '], [' xxx '], {algorithm: algo, output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1882 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1883 diff([' abc '], [' xxx '], {algorithm: algo, output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1884 endfor
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1885 assert_equal("@@ -1 +1 @@\n- abc \n+ xxx \n",
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1886 diff([' abc '], [' xxx '], {indent-heuristic: true, output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1887 assert_equal([{from_idx: 0, from_count: 1, to_idx: 0, to_count: 1}],
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1888 diff([' abc '], [' xxx '], {indent-heuristic: true, output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1889
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1890 # identical strings
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1891 assert_equal('', diff(['111', '222'], ['111', '222'], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1892 assert_equal([], diff(['111', '222'], ['111', '222'], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1893 assert_equal('', diff([], [], {output: 'unified'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1894 assert_equal([], diff([], [], {output: 'indices'}))
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1895
34324
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1896 # If 'diffexpr' is set, it should not be used for diff()
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1897 def MyDiffExpr()
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1898 enddef
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1899 var save_diffexpr = &diffexpr
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1900 :set diffexpr=MyDiffExpr()
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1901 assert_equal("@@ -1 +1 @@\n-abc\n+\n",
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1902 diff(['abc'], [''], {output: 'unified'}))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1903 assert_equal([{'from_idx': 0, 'from_count': 1, 'to_idx': 0, 'to_count': 1}],
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1904 diff(['abc'], [''], {output: 'indices'}))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1905 assert_equal('MyDiffExpr()', &diffexpr)
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1906 &diffexpr = save_diffexpr
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1907
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1908 # try different values for unified diff 'context'
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1909 assert_equal("@@ -0,0 +1 @@\n+x\n",
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1910 diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c']))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1911 assert_equal("@@ -0,0 +1 @@\n+x\n",
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1912 diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 0}))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1913 assert_equal("@@ -1 +1,2 @@\n+x\n a\n",
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1914 diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 1}))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1915 assert_equal("@@ -1,2 +1,3 @@\n+x\n a\n b\n",
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1916 diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 2}))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1917 assert_equal("@@ -1,3 +1,4 @@\n+x\n a\n b\n c\n",
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1918 diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 3}))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1919 assert_equal("@@ -1,3 +1,4 @@\n+x\n a\n b\n c\n",
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1920 diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: 4}))
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1921 assert_equal("@@ -0,0 +1 @@\n+x\n",
34324
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1922 diff(['a', 'b', 'c'], ['x', 'a', 'b', 'c'], {context: -1}))
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1923
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1924 # Error cases
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1925 assert_fails('call diff({}, ["a"])', 'E1211:')
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1926 assert_fails('call diff(["a"], {})', 'E1211:')
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1927 assert_fails('call diff(["a"], ["a"], [])', 'E1206:')
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1928 assert_fails('call diff(["a"], ["a"], {output: "xyz"})', 'E106: Unsupported diff output format: xyz')
34324
6d9f59e88fc2 patch 9.1.0096: diff() function uses 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34264
diff changeset
1929 assert_fails('call diff(["a"], ["a"], {context: []})', 'E745: Using a List as a Number')
34264
cce6b834635c patch 9.1.0071: Need a diff() Vim script function
Christian Brabandt <cb@256bit.org>
parents: 34259
diff changeset
1930 enddef
29275
281509f1417b patch 8.2.5155: in diff mode windows may get out of sync
Bram Moolenaar <Bram@vim.org>
parents: 27990
diff changeset
1931
34332
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1932 " Test for using the diff() function with 'diffexpr'
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1933 func Test_diffexpr_with_diff_func()
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1934 CheckScreendump
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1935
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1936 let lines =<< trim END
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1937 def DiffFuncExpr()
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1938 var in: list<string> = readfile(v:fname_in)
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1939 var new: list<string> = readfile(v:fname_new)
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1940 var out: string = diff(in, new)
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1941 writefile(split(out, "\n"), v:fname_out)
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1942 enddef
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1943 set diffexpr=DiffFuncExpr()
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1944
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1945 edit Xdifffunc1.txt
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1946 diffthis
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1947 vert split Xdifffunc2.txt
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1948 diffthis
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1949 END
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1950 call writefile(lines, 'XsetupDiffFunc.vim', 'D')
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1951
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1952 call writefile(['zero', 'one', 'two', 'three'], 'Xdifffunc1.txt', 'D')
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1953 call writefile(['one', 'twox', 'three', 'four'], 'Xdifffunc2.txt', 'D')
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1954
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1955 let buf = RunVimInTerminal('-S XsetupDiffFunc.vim', {'rows': 12})
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1956 call VerifyScreenDump(buf, 'Test_difffunc_diffexpr_1', {})
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1957 call StopVimInTerminal(buf)
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1958 endfunc
7ccaadd7cf0b patch 9.1.0099: Not able to use diff() with 'diffexpr'
Christian Brabandt <cb@256bit.org>
parents: 34324
diff changeset
1959
34569
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1960 func Test_diff_toggle_wrap_skipcol_leftcol()
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1961 61vnew
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1962 call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.')
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1963 30vnew
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1964 call setline(1, 'ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.')
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1965 let win1 = win_getid()
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1966 setlocal smoothscroll
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1967 exe "normal! $\<C-E>"
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1968 wincmd l
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1969 let win2 = win_getid()
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1970 setlocal smoothscroll
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1971 exe "normal! $\<C-E>"
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1972 call assert_equal([
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1973 \ '<<<sadipscing elitr, sed diam |<<<tetur sadipscing elitr, sed|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1974 \ 'nonumy eirmod tempor invidunt | diam nonumy eirmod tempor inv|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1975 \ 'ut labore et dolore magna aliq|idunt ut labore et dolore magn|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1976 \ 'uyam erat, sed diam voluptua. |a aliquyam erat, sed diam volu|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1977 \ '~ |ptua. |',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1978 \ ], ScreenLines([1, 5], 62))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1979 call assert_equal({'col': 29, 'row': 4, 'endcol': 29, 'curscol': 29},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1980 \ screenpos(win1, line('.', win1), col('.', win1)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1981 call assert_equal({'col': 36, 'row': 5, 'endcol': 36, 'curscol': 36},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1982 \ screenpos(win2, line('.', win2), col('.', win2)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1983
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1984 wincmd h
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1985 diffthis
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1986 wincmd l
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1987 diffthis
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1988 normal! 0
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1989 call assert_equal([
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1990 \ ' ipsum dolor sit amet, conset| Lorem ipsum dolor sit amet, |',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1991 \ '~ |~ |',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1992 \ ], ScreenLines([1, 2], 62))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1993 call assert_equal({'col': 3, 'row': 1, 'endcol': 3, 'curscol': 3},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1994 \ screenpos(win1, line('.', win1), col('.', win1)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1995 call assert_equal({'col': 34, 'row': 1, 'endcol': 34, 'curscol': 34},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1996 \ screenpos(win2, line('.', win2), col('.', win2)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1997
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1998 normal! $
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
1999 call assert_equal([
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2000 \ ' voluptua. | diam voluptua. |',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2001 \ '~ |~ |',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2002 \ ], ScreenLines([1, 2], 62))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2003 call assert_equal({'col': 11, 'row': 1, 'endcol': 11, 'curscol': 11},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2004 \ screenpos(win1, line('.', win1), col('.', win1)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2005 call assert_equal({'col': 48, 'row': 1, 'endcol': 48, 'curscol': 48},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2006 \ screenpos(win2, line('.', win2), col('.', win2)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2007
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2008 diffoff!
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2009 call assert_equal([
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2010 \ 'ipsum dolor sit amet, consetet|Lorem ipsum dolor sit amet, co|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2011 \ 'ur sadipscing elitr, sed diam |nsetetur sadipscing elitr, sed|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2012 \ 'nonumy eirmod tempor invidunt | diam nonumy eirmod tempor inv|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2013 \ 'ut labore et dolore magna aliq|idunt ut labore et dolore magn|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2014 \ 'uyam erat, sed diam voluptua. |a aliquyam erat, sed diam volu|',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2015 \ '~ |ptua. |',
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2016 \ ], ScreenLines([1, 6], 62))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2017 call assert_equal({'col': 29, 'row': 5, 'endcol': 29, 'curscol': 29},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2018 \ screenpos(win1, line('.', win1), col('.', win1)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2019 call assert_equal({'col': 36, 'row': 6, 'endcol': 36, 'curscol': 36},
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2020 \ screenpos(win2, line('.', win2), col('.', win2)))
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2021
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2022 bwipe!
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2023 bwipe!
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2024 endfunc
f41e8218775a patch 9.1.0183: Wrong display or screenpos() result when toggling diff mode
Christian Brabandt <cb@256bit.org>
parents: 34349
diff changeset
2025
34815
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2026 " Ctrl-D reveals filler lines below the last line in the buffer.
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2027 func Test_diff_eob_halfpage()
34850
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2028 new
34815
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2029 call setline(1, ['']->repeat(10) + ['a'])
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2030 diffthis
34850
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2031 new
34815
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2032 call setline(1, ['']->repeat(3) + ['a', 'b'])
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2033 diffthis
34850
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2034 resize 5
34815
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2035 wincmd j
34850
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2036 resize 5
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2037 norm G
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2038 call assert_equal(7, line('w0'))
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2039 exe "norm! \<C-D>"
a93a9b349a5e patch 9.1.0294: Text height function does not respect it's argument
Christian Brabandt <cb@256bit.org>
parents: 34822
diff changeset
2040 call assert_equal(8, line('w0'))
34815
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2041
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2042 %bwipe!
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2043 endfunc
8e38ceda0822 patch 9.1.0280: several issues with 'smoothscroll' support
Christian Brabandt <cb@256bit.org>
parents: 34761
diff changeset
2044
19689
da98d2ed8dc5 patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents: 19007
diff changeset
2045 " vim: shiftwidth=2 sts=2 expandtab