Mercurial > vim
annotate src/testdir/test_messages.vim @ 16817:069ee8dc8c8d v8.1.1410
patch 8.1.1410: popup_move() is not implemented yet
commit https://github.com/vim/vim/commit/60cdb3004abe683e5e8851fa6c5d67b337df4443
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 27 21:54:10 2019 +0200
patch 8.1.1410: popup_move() is not implemented yet
Problem: Popup_move() is not implemented yet.
Solution: Implement it. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/4441) Improve the
positioning and resizing.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 27 May 2019 22:00:07 +0200 |
parents | 57c37c17ff9d |
children | 6990c1160ea5 |
rev | line source |
---|---|
15219
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
1 " Tests for :messages, :echomsg, :echoerr |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
16368
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
3 source shared.vim |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
4 |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 function Test_messages() |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 let oldmore = &more |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 try |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 set nomore |
8905
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
9 " Avoid the "message maintainer" line. |
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
10 let $LANG = '' |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let arr = map(range(10), '"hello" . v:val') |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 for s in arr |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 echomsg s | redraw |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfor |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 let result = '' |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 |
8905
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
18 " get last two messages |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 redir => result |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 2messages | redraw |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 redir END |
8905
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
22 let msg_list = split(result, "\n") |
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
23 call assert_equal(["hello8", "hello9"], msg_list) |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " clear messages without last one |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 1messages clear |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 redir => result |
8905
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
28 redraw | messages |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 redir END |
8905
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
30 let msg_list = split(result, "\n") |
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
31 call assert_equal(['hello9'], msg_list) |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 " clear all messages |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 messages clear |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 redir => result |
8905
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
36 redraw | messages |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 redir END |
8905
9200836eee15
commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents:
8897
diff
changeset
|
38 call assert_equal('', result) |
8897
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 finally |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 let &more = oldmore |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 endtry |
a410390e340b
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 endfunction |
13968
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
43 |
14202
51693b1a640e
patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents:
13968
diff
changeset
|
44 " Patch 7.4.1696 defined the "clearmode()" function for clearing the mode |
13968
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
45 " indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
46 " output could then be disturbed when 'cmdheight' was greater than one. |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
47 " This test ensures that the bugfix for this issue remains in place. |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15219
diff
changeset
|
48 func Test_stopinsert_does_not_break_message_output() |
13968
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
49 set cmdheight=2 |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
50 redraw! |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
51 |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
52 stopinsert | echo 'test echo' |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
53 call assert_equal(116, screenchar(&lines - 1, 1)) |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
54 call assert_equal(32, screenchar(&lines, 1)) |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
55 redraw! |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
56 |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
57 stopinsert | echomsg 'test echomsg' |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
58 call assert_equal(116, screenchar(&lines - 1, 1)) |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
59 call assert_equal(32, screenchar(&lines, 1)) |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
60 redraw! |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
61 |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
8905
diff
changeset
|
62 set cmdheight& |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
15219
diff
changeset
|
63 endfunc |
15097
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14202
diff
changeset
|
64 |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14202
diff
changeset
|
65 func Test_message_completion() |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14202
diff
changeset
|
66 call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx') |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14202
diff
changeset
|
67 call assert_equal('"message clear', @:) |
1946487c74ba
patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
14202
diff
changeset
|
68 endfunc |
15219
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
69 |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
70 func Test_echomsg() |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
71 call assert_equal("\nhello", execute(':echomsg "hello"')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
72 call assert_equal("\n", execute(':echomsg ""')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
73 call assert_equal("\n12345", execute(':echomsg 12345')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
74 call assert_equal("\n[]", execute(':echomsg []')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
75 call assert_equal("\n[1, 2, 3]", execute(':echomsg [1, 2, 3]')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
76 call assert_equal("\n{}", execute(':echomsg {}')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
77 call assert_equal("\n{'a': 1, 'b': 2}", execute(':echomsg {"a": 1, "b": 2}')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
78 if has('float') |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
79 call assert_equal("\n1.23", execute(':echomsg 1.23')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
80 endif |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
81 call assert_match("function('<lambda>\\d*')", execute(':echomsg {-> 1234}')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
82 endfunc |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
83 |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
84 func Test_echoerr() |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
85 call test_ignore_error('IgNoRe') |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
86 call assert_equal("\nIgNoRe hello", execute(':echoerr "IgNoRe hello"')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
87 call assert_equal("\n12345 IgNoRe", execute(':echoerr 12345 "IgNoRe"')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
88 call assert_equal("\n[1, 2, 'IgNoRe']", execute(':echoerr [1, 2, "IgNoRe"]')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
89 call assert_equal("\n{'IgNoRe': 2, 'a': 1}", execute(':echoerr {"a": 1, "IgNoRe": 2}')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
90 if has('float') |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
91 call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
92 endif |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
93 call test_ignore_error('<lambda>') |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
94 call assert_match("function('<lambda>\\d*')", execute(':echoerr {-> 1234}')) |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
95 call test_ignore_error('RESET') |
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15097
diff
changeset
|
96 endfunc |
16368
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
97 |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
98 func Test_mode_message_at_leaving_insert_by_ctrl_c() |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
99 if !has('terminal') || has('gui_running') |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
100 return |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
101 endif |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
102 |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
103 " Set custom statusline built by user-defined function. |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
104 let testfile = 'Xtest.vim' |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
105 call writefile([ |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
106 \ 'func StatusLine() abort', |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
107 \ ' return ""', |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
108 \ 'endfunc', |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
109 \ 'set statusline=%!StatusLine()', |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
110 \ 'set laststatus=2', |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
111 \ ], testfile) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
112 |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
113 let rows = 10 |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
114 let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows}) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
115 call term_wait(buf, 200) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
116 call assert_equal('run', job_status(term_getjob(buf))) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
117 |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
118 call term_sendkeys(buf, "i") |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
119 call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))}) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
120 call term_sendkeys(buf, "\<C-C>") |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
121 call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))}) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
122 |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
123 call term_sendkeys(buf, ":qall!\<CR>") |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
124 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
125 exe buf . 'bwipe!' |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
126 call delete(testfile) |
a3b5cbd2effe
patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents:
15406
diff
changeset
|
127 endfunc |
16374
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
128 |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
129 func Test_mode_message_at_leaving_insert_with_esc_mapped() |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
130 if !has('terminal') || has('gui_running') |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
131 return |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
132 endif |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
133 |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
134 " Set custom statusline built by user-defined function. |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
135 let testfile = 'Xtest.vim' |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
136 call writefile([ |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
137 \ 'set laststatus=2', |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
138 \ 'inoremap <Esc> <Esc>00', |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
139 \ ], testfile) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
140 |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
141 let rows = 10 |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
142 let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows}) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
143 call term_wait(buf, 200) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
144 call assert_equal('run', job_status(term_getjob(buf))) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
145 |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
146 call term_sendkeys(buf, "i") |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
147 call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))}) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
148 call term_sendkeys(buf, "\<Esc>") |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
149 call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))}) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
150 |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
151 call term_sendkeys(buf, ":qall!\<CR>") |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
152 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
153 exe buf . 'bwipe!' |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
154 call delete(testfile) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16368
diff
changeset
|
155 endfunc |