Mercurial > vim
annotate src/testdir/test_history.vim @ 19534:36ec10251b2b v8.2.0324
patch 8.2.0324: text property not updated correctly when inserting/deleting
Commit: https://github.com/vim/vim/commit/12f20038714928bfecdeee31ed1f927324542034
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 26 22:06:00 2020 +0100
patch 8.2.0324: text property not updated correctly when inserting/deleting
Problem: Text property not updated correctly when inserting/deleting.
Solution: Use the right column when deleting. Make zero-width text
properties respect start_incl and end_incl. (Axel Forsman,
closes #5696, closes #5679)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 26 Feb 2020 22:15:04 +0100 |
parents | 738a4fe2c8c5 |
children | bab20768e1fd |
rev | line source |
---|---|
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for the history functions |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature cmdline_hist |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 set history=7 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 function History_Tests(hist) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " First clear the history |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call histadd(a:hist, 'dummy') |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_true(histdel(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call assert_equal(-1, histnr(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal('', histget(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
15 call assert_true('ls'->histadd(a:hist)) |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_true(histadd(a:hist, 'buffers')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_equal('buffers', histget(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal('ls', histget(a:hist, -2)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal('ls', histget(a:hist, 1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal('', histget(a:hist, 5)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal('', histget(a:hist, -5)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(2, histnr(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_true(histdel(a:hist, 2)) |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
24 call assert_false(a:hist->histdel(7)) |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal(1, histnr(a:hist)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal('ls', histget(a:hist, -1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call assert_true(histadd(a:hist, 'buffers')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 call assert_true(histadd(a:hist, 'ls')) |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
30 call assert_equal('ls', a:hist->histget(-1)) |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
31 call assert_equal(4, a:hist->histnr()) |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
10434
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
33 let a=execute('history ' . a:hist) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
34 call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
35 let a=execute('history all') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
36 call assert_match("^\n # .* history\n 3 buffers\n> 4 ls", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
37 |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
38 if len(a:hist) > 0 |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
39 let a=execute('history ' . a:hist . ' 2') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
40 call assert_match("^\n # \\S* history$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
41 let a=execute('history ' . a:hist . ' 3') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
42 call assert_match("^\n # \\S* history\n 3 buffers$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
43 let a=execute('history ' . a:hist . ' 4') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
44 call assert_match("^\n # \\S* history\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
45 let a=execute('history ' . a:hist . ' 3,4') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
46 call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
47 let a=execute('history ' . a:hist . ' -1') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
48 call assert_match("^\n # \\S* history\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
49 let a=execute('history ' . a:hist . ' -2') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
50 call assert_match("^\n # \\S* history\n 3 buffers$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
51 let a=execute('history ' . a:hist . ' -2,') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
52 call assert_match("^\n # \\S* history\n 3 buffers\n> 4 ls$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
53 let a=execute('history ' . a:hist . ' -3') |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
54 call assert_match("^\n # \\S* history$", a) |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
55 endif |
f3bb76ec4155
commit https://github.com/vim/vim/commit/eebd84eb94ed7f59a06a52cb4863563642f58899
Christian Brabandt <cb@256bit.org>
parents:
8406
diff
changeset
|
56 |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 " Test for removing entries matching a pattern |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 for i in range(1, 3) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call histadd(a:hist, 'text_' . i) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 endfor |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 call assert_true(histdel(a:hist, 'text_\d\+')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call assert_equal('ls', histget(a:hist, -1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 " Test for freeing the entire history list |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 for i in range(1, 7) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call histadd(a:hist, 'text_' . i) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 endfor |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call histdel(a:hist) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 for i in range(1, 7) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call assert_equal('', histget(a:hist, i)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 call assert_equal('', histget(a:hist, i - 7 - 1)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 endfor |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 endfunction |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 function Test_History() |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 for h in ['cmd', ':', '', 'search', '/', '?', 'expr', '=', 'input', '@', 'debug', '>'] |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call History_Tests(h) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 endfor |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 " Negative tests |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 call assert_false(histdel('abc')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call assert_equal('', histget('abc')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 call assert_fails('call histdel([])', 'E730:') |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 call assert_equal('', histget(10)) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call assert_fails('call histget([])', 'E730:') |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 call assert_equal(-1, histnr('abc')) |
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 call assert_fails('call histnr([])', 'E730:') |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
88 call assert_fails('history xyz', 'E488:') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
89 call assert_fails('history ,abc', 'E488:') |
8406
5d926807c19c
commit https://github.com/vim/vim/commit/119d4693e06e68d4f099aa7287e375ae3d265fd0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 endfunction |
10565
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
91 |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
92 function Test_Search_history_window() |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
93 new |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
94 call setline(1, ['a', 'b', 'a', 'b']) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
95 1 |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
96 call feedkeys("/a\<CR>", 'xt') |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
97 call assert_equal('a', getline('.')) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
98 1 |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
99 call feedkeys("/b\<CR>", 'xt') |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
100 call assert_equal('b', getline('.')) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
101 1 |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
102 " select the previous /a command |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
103 call feedkeys("q/kk\<CR>", 'x!') |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
104 call assert_equal('a', getline('.')) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
105 call assert_equal('a', @/) |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
106 bwipe! |
ea0dadb041c9
patch 8.0.0172: command line window does not work
Christian Brabandt <cb@256bit.org>
parents:
10434
diff
changeset
|
107 endfunc |
15097
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
108 |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
109 function Test_history_completion() |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
110 call feedkeys(":history \<C-A>\<C-B>\"\<CR>", 'tx') |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
111 call assert_equal('"history / : = > ? @ all cmd debug expr input search', @:) |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
10565
diff
changeset
|
112 endfunc |
19517
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
113 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
114 " Test for increasing the 'history' option value |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
115 func Test_history_size() |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
116 let save_histsz = &history |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
117 call histdel(':') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
118 set history=5 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
119 for i in range(1, 5) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
120 call histadd(':', 'cmd' .. i) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
121 endfor |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
122 call assert_equal(5, histnr(':')) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
123 call assert_equal('cmd5', histget(':', -1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
124 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
125 set history=10 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
126 for i in range(6, 10) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
127 call histadd(':', 'cmd' .. i) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
128 endfor |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
129 call assert_equal(10, histnr(':')) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
130 call assert_equal('cmd1', histget(':', 1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
131 call assert_equal('cmd10', histget(':', -1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
132 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
133 set history=5 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
134 call histadd(':', 'abc') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
135 call assert_equal('', histget(':', 6)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
136 call assert_equal('', histget(':', 12)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
137 call assert_equal('cmd7', histget(':', 7)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
138 call assert_equal('abc', histget(':', -1)) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
139 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
140 let &history=save_histsz |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
141 endfunc |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
142 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
143 " Test for recalling old search patterns in / |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
144 func Test_history_search() |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
145 call histdel('/') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
146 let g:pat = [] |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
147 func SavePat() |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
148 call add(g:pat, getcmdline()) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
149 return '' |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
150 endfunc |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
151 cnoremap <F2> <C-\>eSavePat()<CR> |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
152 call histadd('/', 'pat1') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
153 call histadd('/', 'pat2') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
154 let @/ = '' |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
155 call feedkeys("/\<Up>\<F2>\<Up>\<F2>\<Down>\<Down>\<F2>\<Esc>", 'xt') |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
156 call assert_equal(['pat2', 'pat1', ''], g:pat) |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
157 cunmap <F2> |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
158 delfunc SavePat |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
159 endfunc |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
160 |
738a4fe2c8c5
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
161 " vim: shiftwidth=2 sts=2 expandtab |