Mercurial > vim
annotate src/testdir/test_charsearch.vim @ 31431:552ca9b4218d v9.0.1048
patch 9.0.1048: with "screenline" in 'culopt' cursorline highlight is wrong
Commit: https://github.com/vim/vim/commit/b7acea1806996a9afb9fb8ebfe571b5181063070
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon Dec 12 13:20:43 2022 +0000
patch 9.0.1048: with "screenline" in 'culopt' cursorline highlight is wrong
Problem: With "screenline" in 'culopt' cursorline highlight is wrong.
Solution: Apply the priority logic also when "screenline is in 'culopt'.
(closes #11696)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 12 Dec 2022 14:30:05 +0100 |
parents | 86eb4aba16c3 |
children | f5946a50c931 |
rev | line source |
---|---|
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
1 " Test for character search commands - t, T, f, F, ; and , |
10072
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10145
diff
changeset
|
3 func Test_charsearch() |
10072
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 enew! |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 call append(0, ['Xabcdefghijkemnopqretuvwxyz', |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
6 \ 'Yabcdefghijkemnopqretuvwxyz', |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
10072
diff
changeset
|
7 \ 'Zabcdefghijkemnokqretkvwxyz']) |
10072
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " check that "fe" and ";" work |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 1 |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 normal! ylfep;;p,,p |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_equal('XabcdeXfghijkeXmnopqreXtuvwxyz', getline(1)) |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 " check that save/restore works |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 2 |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 normal! ylfep |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 let csave = getcharsearch() |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 normal! fip |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call setcharsearch(csave) |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 normal! ;p;p |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal('YabcdeYfghiYjkeYmnopqreYtuvwxyz', getline(2)) |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 " check that setcharsearch() changes the settings. |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 3 |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 normal! ylfep |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
24 eval {'char': 'k'}->setcharsearch() |
10072
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 normal! ;p |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call setcharsearch({'forward': 0}) |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 normal! $;p |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call setcharsearch({'until': 1}) |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 set cpo-=; |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 normal! ;;p |
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3)) |
19783
546bdeef35f1
patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
32 |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
33 " check that repeating a search before and after a line fails |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
34 normal 3Gfv |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
35 call assert_beeps('normal ;') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
36 call assert_beeps('normal ,') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
37 |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
38 " clear the character search |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
39 call setcharsearch({'char' : ''}) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
40 call assert_equal('', getcharsearch().char) |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
41 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
22524
diff
changeset
|
42 call assert_fails("call setcharsearch([])", 'E1206:') |
10072
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 enew! |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10145
diff
changeset
|
44 endfunc |
10072
c104f09ae2f4
commit https://github.com/vim/vim/commit/cd055da370114f66c960be9c8b1eb0f33a9e0a85
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
46 " Test for character search in virtual edit mode with <Tab> |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
47 func Test_csearch_virtualedit() |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
48 new |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
49 set virtualedit=all |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
50 call setline(1, "a\tb") |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
51 normal! tb |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
52 call assert_equal([0, 1, 2, 6], getpos('.')) |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
53 set virtualedit& |
22524
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
54 bw! |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
55 endfunc |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
56 |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
57 " Test for character search failure in latin1 encoding |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
58 func Test_charsearch_latin1() |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
59 new |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
60 let save_enc = &encoding |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
61 set encoding=latin1 |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
62 call setline(1, 'abcdefghijk') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
63 call assert_beeps('normal fz') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
64 call assert_beeps('normal tx') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
65 call assert_beeps('normal $Fz') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
66 call assert_beeps('normal $Tx') |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
67 let &encoding = save_enc |
22524
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
68 bw! |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
69 endfunc |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
70 |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
71 " Test for using character search to find a multibyte character with composing |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
72 " characters. |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
73 func Test_charsearch_composing_char() |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
74 new |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
75 call setline(1, "one two thq\u0328\u0301r\u0328\u0301ree") |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
76 call feedkeys("fr\u0328\u0301", 'xt') |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
77 call assert_equal([0, 1, 16, 0, 12], getcurpos()) |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
78 |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
79 " use character search with a multi-byte character followed by a |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
80 " non-composing character |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
81 call setline(1, "abc deȉf ghi") |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
82 call feedkeys("ggcf\u0209\u0210", 'xt') |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
83 call assert_equal("\u0210f ghi", getline(1)) |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
84 bw! |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
85 endfunc |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
86 |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
87 " Test for character search with 'hkmap' |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
88 func Test_charsearch_hkmap() |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
89 new |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
90 set hkmap |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
91 call setline(1, "ùðáâ÷ëòéïçìêöî") |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
92 call feedkeys("fë", 'xt') |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
93 call assert_equal([0, 1, 11, 0, 6], getcurpos()) |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
94 set hkmap& |
1baf86830e44
patch 8.2.1810: some code in normal.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
20848
diff
changeset
|
95 bw! |
20199
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
96 endfunc |
a4bd28e2cf1d
patch 8.2.0655: search code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19783
diff
changeset
|
97 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
98 " vim: shiftwidth=2 sts=2 expandtab |