annotate src/testdir/test_gn.vim @ 18404:b1a10a018f83 v8.1.2196

patch 8.1.2196: MS-Windows: running tests with MSVC lacks updates Commit: https://github.com/vim/vim/commit/d53ebfc6246b2f29752adbda13cd2c11acca285a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 20 21:47:20 2019 +0200 patch 8.1.2196: MS-Windows: running tests with MSVC lacks updates Problem: MS-Windows: running tests with MSVC lacks updates. Solution: Improve running individual tests on MS-Windows. (closes https://github.com/vim/vim/issues/4922)
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Oct 2019 22:00:03 +0200
parents 3b5d401a58ce
children 3b80bdbdc832
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for gn command
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_gn_command()
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
4 noautocmd new
16376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15239
diff changeset
5 " replace a single char by itself quoted:
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call setline('.', 'abc x def x ghi x jkl')
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
7 let @/ = 'x'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 exe "norm! cgn'x'\<esc>.."
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_equal("abc 'x' def 'x' ghi 'x' jkl", getline('.'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 sil! %d_
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
11
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 " simple search match
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call setline('.', 'foobar')
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
14 let @/ = 'foobar'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 exe "norm! gncsearchmatch"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal('searchmatch', getline('.'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
18
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 " replace a multi-line match
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call setline('.', ['', 'one', 'two'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
21 let @/ = 'one\_s*two\_s'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 exe "norm! gnceins\<CR>zwei"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal(['','eins','zwei'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
25
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " test count argument
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call setline('.', ['', 'abcdx | abcdx | abcdx'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
28 let @/ = '[a]bcdx'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 exe "norm! 2gnd"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal(['','abcdx | | abcdx'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
32
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " join lines
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call setline('.', ['join ', 'lines'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
35 let @/ = '$'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 exe "norm! 0gnd"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call assert_equal(['join lines'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
39
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " zero-width match
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call setline('.', ['', 'zero width pattern'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
42 let @/ = '\>\zs'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 exe "norm! 0gnd"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal(['', 'zerowidth pattern'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
46
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 " delete first and last chars
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call setline('.', ['delete first and last chars'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
49 let @/ = '^'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 exe "norm! 0gnd$"
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
51 let @/ = '\zs'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 exe "norm! gnd"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal(['elete first and last char'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
55
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 " using visual mode
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call setline('.', ['', 'uniquepattern uniquepattern'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 exe "norm! /[u]niquepattern/s\<cr>vlgnd"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call assert_equal(['', ' uniquepattern'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
61
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 " backwards search
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 call setline('.', ['my very excellent mother just served us nachos'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
64 let @/ = 'mother'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 exe "norm! $cgNmongoose"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call assert_equal(['my very excellent mongoose just served us nachos'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
68
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 " search for single char
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call setline('.', ['','for (i=0; i<=10; i++)'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
71 let @/ = 'i'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 exe "norm! cgnj"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal(['','for (j=0; i<=10; i++)'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
75
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 " search hex char
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call setline('.', ['','Y'])
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 set noignorecase
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
79 let @/ = '\%x59'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 exe "norm! gnd"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call assert_equal(['',''], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
83
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 " test repeating gdn
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call setline('.', ['', '1', 'Johnny', '2', 'Johnny', '3'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
86 let @/ = 'Johnny'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 exe "norm! dgn."
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call assert_equal(['','1', '', '2', '', '3'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
90
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 " test repeating gUgn
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call setline('.', ['', '1', 'Depp', '2', 'Depp', '3'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
93 let @/ = 'Depp'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 exe "norm! gUgn."
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 call assert_equal(['', '1', 'DEPP', '2', 'DEPP', '3'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
97
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 " test using look-ahead assertions
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 call setline('.', ['a:10', '', 'a:1', '', 'a:20'])
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
100 let @/ = 'a:0\@!\zs\d\+'
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 exe "norm! 2nygno\<esc>p"
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal(['a:10', '', 'a:1', '1', '', 'a:20'], getline(1,'$'))
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 sil! %d _
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
104
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
105 " test using nowrapscan
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
106 set nowrapscan
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
107 call setline(1, 'foo bar baz')
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
108 exe "norm! /bar/e\<cr>"
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
109 exe "norm! gnd"
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
110 call assert_equal(['foo baz'], getline(1,'$'))
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
111 sil! %d_
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
112
12539
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
113 " search upwards with nowrapscan set
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
114 call setline('.', ['foo', 'bar', 'foo', 'baz'])
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
115 set nowrapscan
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
116 let @/ = 'foo'
12539
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
117 $
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
118 norm! dgN
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
119 call assert_equal(['foo', 'bar', '', 'baz'], getline(1,'$'))
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
120 sil! %d_
6d3584b60170 patch 8.0.1148: gN doesn't work on last match with 'wrapscan' off
Christian Brabandt <cb@256bit.org>
parents: 11488
diff changeset
121
14000
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
122 " search using the \zs atom
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
123 call setline(1, [' nnoremap', '' , 'nnoremap'])
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
124 set wrapscan&vim
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
125 let @/ = '\_s\zsnnoremap'
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
126 $
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
127 norm! cgnmatch
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
128 call assert_equal([' nnoremap', '', 'match'], getline(1,'$'))
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
129 sil! %d_
96933f0ecbd1 patch 8.1.0018: using "gn" may select wrong text when wrapping
Christian Brabandt <cb@256bit.org>
parents: 12644
diff changeset
130
11488
9473793c7bb5 patch 8.0.0627: "gn" selects only one character with 'nowrapscan'
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
131 set wrapscan&vim
9647
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 endfu
847518911c0b commit https://github.com/vim/vim/commit/6835dc61aebca2b602d85a9d63c449ace58683b4
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
15239
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
134 func Test_gn_multi_line()
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
135 new
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
136 call setline(1, [
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
137 \ 'func Tm1()',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
138 \ ' echo "one"',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
139 \ 'endfunc',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
140 \ 'func Tm2()',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
141 \ ' echo "two"',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
142 \ 'endfunc',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
143 \ 'func Tm3()',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
144 \ ' echo "three"',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
145 \ 'endfunc',
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
146 \])
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
147 /\v^func Tm\d\(\)\n.*\zs".*"\ze$
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
148 normal jgnrx
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
149 call assert_equal(' echo xxxxx', getline(5))
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
150 bwipe!
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
151 endfunc
db5d2429bda3 patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents: 14000
diff changeset
152
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9647
diff changeset
153 " vim: shiftwidth=2 sts=2 expandtab