annotate src/testdir/test_gf.vim @ 15062:3a94f7918980 v8.1.0542

patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account commit https://github.com/vim/vim/commit/f951416a8396a54bbbe21de1a8b16716428549f2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 22 03:08:29 2018 +0100 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account Problem: shiftwidth() does not take 'vartabstop' into account. Solution: Use the cursor position or a position explicitly passed. Also make >> and << work better with 'vartabstop'. (Christian Brabandt)
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Nov 2018 03:15:10 +0100
parents 788d01164bb2
children 58610c4d785c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " 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
3 " 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
4 func Test_gf_url()
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 enew!
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call append(0, [
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 \ "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
8 \ "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
9 \ "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
10 \ "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
11 \ "fifth test for URL://machine.name/tmp?q=vim&opt=yes and other text",
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ ])
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call search("^first")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call search("tmp")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 call search("^second")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call search("URL")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 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
20 if has("ebcdic")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 set isf=@,240-249,/,.,-,_,+,,,$,:,~,\
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 else
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 set isf=@,48-57,/,.,-,_,+,,,$,:,~,\
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 endif
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call search("^third")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call search("name")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 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
28 call search("^fourth")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call search("URL")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 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
31
13103
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
32 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
33 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
34 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
35
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 set isf&vim
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 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
38 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
39
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
40 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
41 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
42 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
43 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
44 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
45 new
11440
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
46 set isfname-=:
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
47 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
48 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
49 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
50 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
51 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
52 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
53 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
54 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
55
11440
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
56 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
57 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
58 call delete('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
59 bwipe 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
60 bwipe 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
61 endfunc