Mercurial > vim
annotate src/testdir/test_gf.vim @ 24649:31a7fa6b2e93 v8.2.2863
patch 8.2.2863: removing a text property does not redraw optimally
Commit: https://github.com/vim/vim/commit/965c04486c9364ded99b49c86f4c41228503df1f
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 17 00:22:06 2021 +0200
patch 8.2.2863: removing a text property does not redraw optimally
Problem: Removing a text property does not redraw optimally.
Solution: Only redraw the lines that mithg actually have been changed.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 May 2021 00:30:04 +0200 |
parents | 1503ecd54f8a |
children | c2c40cefc17b |
rev | line source |
---|---|
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
1 " Test for the gf and gF (goto file) commands |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " This is a test if a URL is recognized by "gf", with the cursor before and |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " after the "://". Also test ":\\". |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
5 func Test_gf_url() |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 enew! |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call append(0, [ |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 \ "first test for URL://machine.name/tmp/vimtest2a and other text", |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 \ "second test for URL://machine.name/tmp/vimtest2b. And other text", |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 \ "third test for URL:\\\\machine.name\\vimtest2c and other text", |
13103
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
11 \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text", |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
12 \ "fifth test for URL://machine.name/tmp?q=vim&opt=yes and other text", |
15993
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
13 \ "sixth test for URL://machine.name:1234?q=vim and other text", |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 \ ]) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call cursor(1,1) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call search("^first") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call search("tmp") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call search("^second") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call search("URL") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 if has("ebcdic") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 else |
15993
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
25 set isf=@,48-57,/,.,-,_,+,,,$,~,\ |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endif |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call search("^third") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call search("name") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call search("^fourth") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call search("URL") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
13103
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
34 call search("^fifth") |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
35 call search("URL") |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
36 call assert_equal("URL://machine.name/tmp?q=vim&opt=yes", expand("<cfile>")) |
788d01164bb2
patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents:
11440
diff
changeset
|
37 |
15993
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
38 call search("^sixth") |
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
39 call search("URL") |
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
40 call assert_equal("URL://machine.name:1234?q=vim", expand("<cfile>")) |
58610c4d785c
patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents:
13103
diff
changeset
|
41 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
42 %d |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
43 call setline(1, "demo://remote_file") |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
44 wincmd f |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
45 call assert_equal('demo://remote_file', @%) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
46 call assert_equal(2, winnr('$')) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
47 close! |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
48 |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 set isf&vim |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 enew! |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
51 endfunc |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
52 |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
53 func Test_gF() |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
54 new |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
55 call setline(1, ['111', '222', '333', '444']) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
56 w! Xfile |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
57 close |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
58 new |
11440
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
59 set isfname-=: |
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
60 call setline(1, ['one', 'Xfile:3', 'three']) |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
61 2 |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
62 call assert_fails('normal gF', 'E37:') |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
63 call assert_equal(2, getcurpos()[1]) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
64 w! Xfile2 |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
65 normal gF |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
66 call assert_equal('Xfile', bufname('%')) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
67 call assert_equal(3, getcurpos()[1]) |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
68 |
18939
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
69 enew! |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
70 call setline(1, ['one', 'the Xfile line 2, and more', 'three']) |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
71 w! Xfile2 |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
72 normal 2GfX |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
73 normal gF |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
74 call assert_equal('Xfile', bufname('%')) |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
75 call assert_equal(2, getcurpos()[1]) |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
76 |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
77 " jumping to the file/line with CTRL-W_F |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
78 %bw! |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
79 edit Xfile1 |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
80 call setline(1, ['one', 'Xfile:4', 'three']) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
81 exe "normal 2G\<C-W>F" |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
82 call assert_equal('Xfile', bufname('%')) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
83 call assert_equal(4, getcurpos()[1]) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
84 |
11440
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
85 set isfname& |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
86 call delete('Xfile') |
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
87 call delete('Xfile2') |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
88 %bw! |
11436
69b52a770b29
patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents:
10145
diff
changeset
|
89 endfunc |
16564
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
90 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
91 " Test for invoking 'gf' on a ${VAR} variable |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
92 func Test_gf() |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
93 if has("ebcdic") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
94 set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,} |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
95 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
96 set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
97 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
98 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
99 call writefile(["Test for gf command"], "Xtest1") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
100 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
101 call writefile([" ${CDIR}/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
102 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
103 call writefile([" $TDIR/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
104 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
105 new Xtestgf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
106 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
107 let $CDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
108 /CDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
109 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
110 if has("amiga") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
111 let $TDIR = "/testdir" |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
112 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
113 let $TDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
114 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
115 /TDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
116 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
117 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
118 normal gf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
119 call assert_equal('Xtest1', fnamemodify(bufname(''), ":t")) |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
120 close! |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
121 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
122 call delete('Xtest1') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
123 call delete('Xtestgf') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
124 endfunc |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
125 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
126 func Test_gf_visual() |
22270
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
127 call writefile(['one', 'two', 'three', 'four'], "Xtest_gf_visual") |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
128 new |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
129 call setline(1, 'XXXtest_gf_visualXXX') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
130 set hidden |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
131 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
132 " Visually select Xtest_gf_visual and use gf to go to that file |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
133 norm! ttvtXgf |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
134 call assert_equal('Xtest_gf_visual', bufname('%')) |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
135 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
136 " if multiple lines are selected, then gf should fail |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
137 call setline(1, ["one", "two"]) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
138 normal VGgf |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
139 call assert_equal('Xtest_gf_visual', @%) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
140 |
22270
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
141 " following line number is used for gF |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
142 bwipe! |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
143 new |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
144 call setline(1, 'XXXtest_gf_visual:3XXX') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
145 norm! 0ttvt:gF |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
146 call assert_equal('Xtest_gf_visual', bufname('%')) |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
147 call assert_equal(3, getcurpos()[1]) |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
148 |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
149 " line number in visual area is used for file name |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
150 if has('unix') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
151 bwipe! |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
152 call writefile([], "Xtest_gf_visual:3") |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
153 new |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
154 call setline(1, 'XXXtest_gf_visual:3XXX') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
155 norm! 0ttvtXgF |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
156 call assert_equal('Xtest_gf_visual:3', bufname('%')) |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
157 call delete('Xtest_gf_visual:3') |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
158 endif |
d37e4a856246
patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
159 |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
160 bwipe! |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
161 call delete('Xtest_gf_visual') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
162 set hidden& |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
163 endfunc |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
164 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
165 func Test_gf_error() |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
166 new |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
167 call assert_fails('normal gf', 'E446:') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
168 call assert_fails('normal gF', 'E446:') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
169 call setline(1, '/doesnotexist') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
170 call assert_fails('normal gf', 'E447:') |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
171 call assert_fails('normal gF', 'E447:') |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
172 call assert_fails('normal [f', 'E447:') |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
173 |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
174 " gf is not allowed when text is locked |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
175 au InsertCharPre <buffer> normal! gF<CR> |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
176 let caught_e565 = 0 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
177 try |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
178 call feedkeys("ix\<esc>", 'xt') |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
179 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565 |
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
180 let caught_e565 = 1 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
181 endtry |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
182 call assert_equal(1, caught_e565) |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
183 au! InsertCharPre |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
184 |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
185 bwipe! |
22502
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
186 |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
187 " gf is not allowed when buffer is locked |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
188 new |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
189 augroup Test_gf |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
190 au! |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
191 au OptionSet diff norm! gf |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
192 augroup END |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
193 call setline(1, ['Xfile1', 'line2', 'line3', 'line4']) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
194 call test_override('starting', 1) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
195 call assert_fails('diffthis', 'E788:') |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
196 call test_override('starting', 0) |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
197 augroup Test_gf |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
198 au! |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
199 augroup END |
1503ecd54f8a
patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
22270
diff
changeset
|
200 bw! |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
201 endfunc |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
202 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
203 " If a file is not found by 'gf', then 'includeexpr' should be used to locate |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
204 " the file. |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
205 func Test_gf_includeexpr() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
206 new |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
207 let g:Inc_fname = '' |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
208 func IncFunc() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
209 let g:Inc_fname = v:fname |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
210 return v:fname |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
211 endfunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
212 setlocal includeexpr=IncFunc() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
213 call setline(1, 'somefile.java') |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
214 call assert_fails('normal gf', 'E447:') |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
215 call assert_equal('somefile.java', g:Inc_fname) |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
216 close! |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
217 delfunc IncFunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
218 endfunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
219 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
220 " vim: shiftwidth=2 sts=2 expandtab |