annotate src/testdir/test_messages.vim @ 18478:94223687df0e

Added tag v8.1.2233 for changeset e93cab5d0f0f27fad7882f1f412927df055b090d
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Oct 2019 04:30:05 +0100
parents 8a2fb21c23c0
children 54baf548bff9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17833
diff changeset
93 eval '<lambda>'->test_ignore_error()
15219
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'
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
105 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
106 func StatusLine() abort
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
107 return ""
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
108 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
109 set statusline=%!StatusLine()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
110 set laststatus=2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
111 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
112 call writefile(lines, testfile)
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
113
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
114 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
115 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
116 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
117 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
118
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
119 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
120 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
121 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
122 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
123
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
124 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
125 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
126 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
127 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
128 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
129
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 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
131 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
132 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
133 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
134
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 " 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
136 let testfile = 'Xtest.vim'
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
137 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
138 set laststatus=2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
139 inoremap <Esc> <Esc>00
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
140 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
141 call writefile(lines, testfile)
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
142
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 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
144 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
145 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
146 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
147
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, "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
149 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
150 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
151 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
152
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 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
154 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
155 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
156 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
157 endfunc
17833
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
158
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
159 func Test_echospace()
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
160 set noruler noshowcmd laststatus=1
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
161 call assert_equal(&columns - 1, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
162 split
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
163 call assert_equal(&columns - 1, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
164 set ruler
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
165 call assert_equal(&columns - 1, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
166 close
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
167 call assert_equal(&columns - 19, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
168 set showcmd noruler
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
169 call assert_equal(&columns - 12, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
170 set showcmd ruler
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
171 call assert_equal(&columns - 29, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
172
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
173 set ruler& showcmd&
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
174 endfunc