annotate src/testdir/test_messages.vim @ 30705:12e6c7bae2a9 v9.0.0687

patch 9.0.0687: "export def" does not work in a nested block Commit: https://github.com/vim/vim/commit/5ab300195b0831cbdba3ce349416a0e6a218e4ef Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 7 17:26:22 2022 +0100 patch 9.0.0687: "export def" does not work in a nested block Problem: "export def" does not work in a nested block. Solution: Do not handle "export" with a separate function but in the same command stack. (closes #11304)
author Bram Moolenaar <Bram@vim.org>
date Fri, 07 Oct 2022 18:30:06 +0200
parents d914a3812d5b
children 1d3caf811eb5
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
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 20603
diff changeset
3 source check.vim
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
4 source shared.vim
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
5 source term_util.vim
20571
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
6 source view_util.vim
22592
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
7 source screendump.vim
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
8
20168
be661435893a patch 8.2.0639: MS-Windows: messages test still fails
Bram Moolenaar <Bram@vim.org>
parents: 20166
diff changeset
9 func Test_messages()
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 let oldmore = &more
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 try
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 set nomore
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 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
15 for s in arr
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 echomsg s | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 endfor
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
19 " get last two messages
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 redir => result
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 2messages | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 redir END
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
23 let msg_list = split(result, "\n")
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
24 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
25
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " clear messages without last one
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 1messages clear
20168
be661435893a patch 8.2.0639: MS-Windows: messages test still fails
Bram Moolenaar <Bram@vim.org>
parents: 20166
diff changeset
28 let msg_list = GetMessages()
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
29 call assert_equal(['hello9'], msg_list)
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " clear all messages
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 messages clear
20168
be661435893a patch 8.2.0639: MS-Windows: messages test still fails
Bram Moolenaar <Bram@vim.org>
parents: 20166
diff changeset
33 let msg_list = GetMessages()
be661435893a patch 8.2.0639: MS-Windows: messages test still fails
Bram Moolenaar <Bram@vim.org>
parents: 20166
diff changeset
34 call assert_equal([], msg_list)
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 finally
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 let &more = oldmore
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 endtry
20041
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
38
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
39 call assert_fails('message 1', 'E474:')
20168
be661435893a patch 8.2.0639: MS-Windows: messages test still fails
Bram Moolenaar <Bram@vim.org>
parents: 20166
diff changeset
40 endfunc
13968
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
41
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 13968
diff changeset
42 " 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
43 " 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
44 " 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
45 " 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
46 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
47 set cmdheight=2
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
48 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
49
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
50 stopinsert | echo 'test echo'
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
51 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
52 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
53 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
54
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
55 stopinsert | echomsg 'test echomsg'
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
56 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
57 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
58 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
59
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
60 set cmdheight&
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 15219
diff changeset
61 endfunc
15097
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
62
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
63 func Test_message_completion()
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
64 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
65 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
66 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
67
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
68 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
69 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
70 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
71 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
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("\n[1, 2, 3]", execute(':echomsg [1, 2, 3]'))
20126
831b1ea43020 patch 8.2.0618: echoing a null list results in no output
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
74 call assert_equal("\n[1, 2, []]", execute(':echomsg [1, 2, test_null_list()]'))
15219
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{}", 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
76 call assert_equal("\n{'a': 1, 'b': 2}", execute(':echomsg {"a": 1, "b": 2}'))
30310
029c59bf78f1 patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents: 30222
diff changeset
77 call assert_equal("\n1.23", execute(':echomsg 1.23'))
15219
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
78 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
79 endfunc
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
80
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
81 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
82 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
83 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
84 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
85 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
86 call assert_equal("\n{'IgNoRe': 2, 'a': 1}", execute(':echoerr {"a": 1, "IgNoRe": 2}'))
30310
029c59bf78f1 patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents: 30222
diff changeset
87 call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"'))
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17833
diff changeset
88 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
89 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
90 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
91 endfunc
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
92
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
93 func Test_mode_message_at_leaving_insert_by_ctrl_c()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20627
diff changeset
94 CheckFeature terminal
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20627
diff changeset
95 CheckNotGui
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
96
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
97 " 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
98 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
99 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
100 func StatusLine() abort
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
101 return ""
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
102 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
103 set statusline=%!StatusLine()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
104 set laststatus=2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
105 END
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30543
diff changeset
106 call writefile(lines, testfile, 'D')
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
107
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
108 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
109 let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19754
diff changeset
110 call TermWait(buf, 100)
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
111 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
112
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
113 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
114 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
115 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
116 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
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, ":qall!\<CR>")
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_equal('dead', job_status(term_getjob(buf)))})
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30543
diff changeset
120
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
121 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
122 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
123
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
124 func Test_mode_message_at_leaving_insert_with_esc_mapped()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20627
diff changeset
125 CheckFeature terminal
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20627
diff changeset
126 CheckNotGui
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
127
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 " 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
129 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
130 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
131 set laststatus=2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
132 inoremap <Esc> <Esc>00
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
133 END
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30543
diff changeset
134 call writefile(lines, testfile, 'D')
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
135
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 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
137 let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19754
diff changeset
138 call WaitForAssert({-> assert_match('0,0-1\s*All$', term_getline(buf, rows - 1))})
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
139 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
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 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
142 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
143 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
144 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
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, ":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
147 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30543
diff changeset
148
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
149 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
150 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
151
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
152 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
153 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
154 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
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 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
163 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
164 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
165
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 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
167 endfunc
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
168
30351
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
169 func Test_warning_scroll()
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
170 CheckRunVimInTerminal
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
171 let lines =<< trim END
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
172 call test_override('ui_delay', 50)
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
173 set noruler
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
174 set readonly
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
175 undo
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
176 END
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
177 call writefile(lines, 'XTestWarningScroll', 'D')
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
178 let buf = RunVimInTerminal('', #{rows: 8})
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
179
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
180 " When the warning comes from a script, messages are scrolled so that the
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
181 " stacktrace is visible.
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
182 call term_sendkeys(buf, ":source XTestWarningScroll\n")
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
183 " only match the final colon in the line that shows the source
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
184 call WaitForAssert({-> assert_match(':$', term_getline(buf, 5))})
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
185 call WaitForAssert({-> assert_equal('line 4:W10: Warning: Changing a readonly file', term_getline(buf, 6))})
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
186 call WaitForAssert({-> assert_equal('Already at oldest change', term_getline(buf, 7))})
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
187 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 8))})
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
188 call term_sendkeys(buf, "\n")
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
189
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
190 " When the warning does not come from a script, messages are not scrolled.
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
191 call term_sendkeys(buf, ":enew\n")
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
192 call term_sendkeys(buf, ":set readonly\n")
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
193 call term_sendkeys(buf, 'u')
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
194 call WaitForAssert({-> assert_equal('W10: Warning: Changing a readonly file', term_getline(buf, 8))})
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
195 call WaitForAssert({-> assert_equal('Already at oldest change', term_getline(buf, 8))})
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
196
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
197 " clean up
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
198 call StopVimInTerminal(buf)
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
199 endfunc
c8c7adcf2ddc patch 9.0.0511: unnecessary scrolling for message of only one line
Bram Moolenaar <Bram@vim.org>
parents: 30310
diff changeset
200
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
201 " Test more-prompt (see :help more-prompt).
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
202 func Test_message_more()
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 20603
diff changeset
203 CheckRunVimInTerminal
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
204 let buf = RunVimInTerminal('', {'rows': 6})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
205 call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
206
29515
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
207 call term_sendkeys(buf, ":%pfoo\<C-H>\<C-H>\<C-H>#")
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
208 call WaitForAssert({-> assert_equal(':%p#', term_getline(buf, 6))})
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
209 call term_sendkeys(buf, "\n")
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
210 call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
211 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
212
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
213 call term_sendkeys(buf, '?')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
214 call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
215 call WaitForAssert({-> assert_equal('-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit ', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
216
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
217 " Down a line with j, <CR>, <NL> or <Down>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
218 call term_sendkeys(buf, "j")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
219 call WaitForAssert({-> assert_equal(' 6 6', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
220 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
221 call term_sendkeys(buf, "\<NL>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
222 call WaitForAssert({-> assert_equal(' 7 7', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
223 call term_sendkeys(buf, "\<CR>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
224 call WaitForAssert({-> assert_equal(' 8 8', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
225 call term_sendkeys(buf, "\<Down>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
226 call WaitForAssert({-> assert_equal(' 9 9', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
227
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
228 " Down a screen with <Space>, f, or <PageDown>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
229 call term_sendkeys(buf, 'f')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
230 call WaitForAssert({-> assert_equal(' 14 14', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
231 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
232 call term_sendkeys(buf, ' ')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
233 call WaitForAssert({-> assert_equal(' 19 19', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
234 call term_sendkeys(buf, "\<PageDown>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
235 call WaitForAssert({-> assert_equal(' 24 24', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
236
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
237 " Down a page (half a screen) with d.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
238 call term_sendkeys(buf, 'd')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
239 call WaitForAssert({-> assert_equal(' 27 27', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
240
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
241 " Down all the way with 'G'.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
242 call term_sendkeys(buf, 'G')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
243 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
244 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
245
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
246 " Up a line k, <BS> or <Up>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
247 call term_sendkeys(buf, 'k')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
248 call WaitForAssert({-> assert_equal(' 99 99', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
249 call term_sendkeys(buf, "\<BS>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
250 call WaitForAssert({-> assert_equal(' 98 98', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
251 call term_sendkeys(buf, "\<Up>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
252 call WaitForAssert({-> assert_equal(' 97 97', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
253
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
254 " Up a screen with b or <PageUp>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
255 call term_sendkeys(buf, 'b')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
256 call WaitForAssert({-> assert_equal(' 92 92', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
257 call term_sendkeys(buf, "\<PageUp>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
258 call WaitForAssert({-> assert_equal(' 87 87', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
259
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
260 " Up a page (half a screen) with u.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
261 call term_sendkeys(buf, 'u')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
262 call WaitForAssert({-> assert_equal(' 84 84', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
263
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
264 " Up all the way with 'g'.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
265 call term_sendkeys(buf, 'g')
29459
7a2569ab418e patch 9.0.0071: command overlaps with printed text in scrollback
Bram Moolenaar <Bram@vim.org>
parents: 28105
diff changeset
266 call WaitForAssert({-> assert_equal(' 4 4', term_getline(buf, 5))})
7a2569ab418e patch 9.0.0071: command overlaps with printed text in scrollback
Bram Moolenaar <Bram@vim.org>
parents: 28105
diff changeset
267 call WaitForAssert({-> assert_equal(':%p#', term_getline(buf, 1))})
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
268 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
269
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
270 " All the way down. Pressing f should do nothing but pressing
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
271 " space should end the more prompt.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
272 call term_sendkeys(buf, 'G')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
273 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
274 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
275 call term_sendkeys(buf, 'f')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
276 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
277 call term_sendkeys(buf, ' ')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
278 call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
279
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
280 " Pressing g< shows the previous command output.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
281 call term_sendkeys(buf, 'g<')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
282 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
283 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
284
29515
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
285 " A command line that doesn't print text is appended to scrollback,
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
286 " even if it invokes a nested command line.
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
287 call term_sendkeys(buf, ":\<C-R>=':'\<CR>:\<CR>g<")
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
288 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 4))})
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
289 call WaitForAssert({-> assert_equal(':::', term_getline(buf, 5))})
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
290 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
e988bbf50e09 patch 9.0.0099: scrollback can be wrong after redrawing the command line
Bram Moolenaar <Bram@vim.org>
parents: 29459
diff changeset
291
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
292 call term_sendkeys(buf, ":%p#\n")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
293 call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
294 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
295
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
296 " Stop command output with q, <Esc> or CTRL-C.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
297 call term_sendkeys(buf, 'q')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
298 call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
299
24134
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
300 " Execute a : command from the more prompt
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
301 call term_sendkeys(buf, ":%p#\n")
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
302 call term_wait(buf)
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
303 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
304 call term_sendkeys(buf, ":")
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
305 call term_wait(buf)
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
306 call WaitForAssert({-> assert_equal(':', term_getline(buf, 6))})
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
307 call term_sendkeys(buf, "echo 'Hello'\n")
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
308 call term_wait(buf)
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
309 call WaitForAssert({-> assert_equal('Hello ', term_getline(buf, 5))})
72e9b861bc92 patch 8.2.2608: character input not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 23132
diff changeset
310
19279
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
311 call StopVimInTerminal(buf)
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
312 endfunc
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
313
30513
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
314 " Test more-prompt scrollback
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
315 func Test_message_more_scrollback()
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
316 CheckRunVimInTerminal
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
317
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
318 let lines =<< trim END
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
319 set t_ut=
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
320 hi Normal ctermfg=15 ctermbg=0
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
321 for i in range(100)
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
322 echo i
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
323 endfor
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
324 END
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
325 call writefile(lines, 'XmoreScrollback', 'D')
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
326 let buf = RunVimInTerminal('-S XmoreScrollback', {'rows': 10})
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
327 call VerifyScreenDump(buf, 'Test_more_scrollback_1', {})
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
328
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
329 call term_sendkeys(buf, 'f')
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
330 call TermWait(buf)
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
331 call term_sendkeys(buf, 'b')
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
332 call VerifyScreenDump(buf, 'Test_more_scrollback_2', {})
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
333
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
334 call term_sendkeys(buf, 'q')
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
335 call TermWait(buf)
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
336 call StopVimInTerminal(buf)
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
337 endfunc
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
338
30519
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
339 " Test verbose message before echo command
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
340 func Test_echo_verbose_system()
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
341 CheckRunVimInTerminal
30543
a1b4d1dae6b1 patch 9.0.0607: verbose echo message test fails on Mac OS
Bram Moolenaar <Bram@vim.org>
parents: 30519
diff changeset
342 CheckUnix " needs the "seq" command
a1b4d1dae6b1 patch 9.0.0607: verbose echo message test fails on Mac OS
Bram Moolenaar <Bram@vim.org>
parents: 30519
diff changeset
343 CheckNotMac " doesn't use /tmp
30519
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
344
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
345 let buf = RunVimInTerminal('', {'rows': 10})
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
346 call term_sendkeys(buf, ":4 verbose echo system('seq 20')\<CR>")
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
347 " Note that the screendump is filtered to remove the name of the temp file
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
348 call VerifyScreenDump(buf, 'Test_verbose_system_1', {})
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
349
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
350 " display a page and go back, results in exactly the same view
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
351 call term_sendkeys(buf, ' ')
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
352 call TermWait(buf)
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
353 call term_sendkeys(buf, 'b')
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
354 call VerifyScreenDump(buf, 'Test_verbose_system_1', {})
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
355
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
356 " do the same with 'cmdheight' set to 2
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
357 call term_sendkeys(buf, 'q')
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
358 call TermWait(buf)
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
359 call term_sendkeys(buf, ":set ch=2\<CR>")
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
360 call TermWait(buf)
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
361 call term_sendkeys(buf, ":4 verbose echo system('seq 20')\<CR>")
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
362 call VerifyScreenDump(buf, 'Test_verbose_system_2', {})
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
363
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
364 call term_sendkeys(buf, ' ')
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
365 call TermWait(buf)
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
366 call term_sendkeys(buf, 'b')
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
367 call VerifyScreenDump(buf, 'Test_verbose_system_2', {})
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
368
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
369 call term_sendkeys(buf, 'q')
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
370 call TermWait(buf)
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
371 call StopVimInTerminal(buf)
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
372 endfunc
4a88061200c2 patch 9.0.0595: extra newline in messages after a verbose shell message
Bram Moolenaar <Bram@vim.org>
parents: 30513
diff changeset
373
30513
ea15dfc9c155 patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents: 30511
diff changeset
374
19279
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
375 func Test_ask_yesno()
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 20603
diff changeset
376 CheckRunVimInTerminal
19279
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
377 let buf = RunVimInTerminal('', {'rows': 6})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
378 call term_sendkeys(buf, ":call setline(1, range(1, 2))\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
379
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
380 call term_sendkeys(buf, ":2,1s/^/n/\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
381 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
382 call term_sendkeys(buf, "n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
383 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
384 call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
385
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
386 call term_sendkeys(buf, ":2,1s/^/Esc/\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
387 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
388 call term_sendkeys(buf, "\<Esc>")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
389 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
390 call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
391
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
392 call term_sendkeys(buf, ":2,1s/^/y/\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
393 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
394 call term_sendkeys(buf, "y")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
395 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?y *2,1 *All$', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
396 call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
397 call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
398
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
399 call StopVimInTerminal(buf)
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
400 endfunc
19081
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
401
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
402 func Test_null()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
403 echom test_null_list()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
404 echom test_null_dict()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
405 echom test_null_blob()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
406 echom test_null_string()
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20126
diff changeset
407 echom test_null_function()
19081
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
408 echom test_null_partial()
19083
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
409 if has('job')
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
410 echom test_null_job()
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
411 echom test_null_channel()
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
412 endif
19081
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
413 endfunc
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20126
diff changeset
414
20571
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
415 func Test_mapping_at_hit_return_prompt()
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
416 nnoremap <C-B> :echo "hit ctrl-b"<CR>
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
417 call feedkeys(":ls\<CR>", "xt")
20627
8bce783af0cb patch 8.2.0867: using {xxx} for encoding a modifier is not nice
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
418 call feedkeys("\<*C-B>", "xt")
20571
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
419 call assert_match('hit ctrl-b', Screenline(&lines - 1))
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
420 nunmap <C-B>
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
421 endfunc
5995db0fe84a patch 8.2.0839: dropping modifier when putting a character back in typeahead
Bram Moolenaar <Bram@vim.org>
parents: 20221
diff changeset
422
22592
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
423 func Test_quit_long_message()
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
424 CheckScreendump
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
425
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
426 let content =<< trim END
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
427 echom range(9999)->join("\x01")
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
428 END
30501
f85930a64d7b patch 9.0.0586: missing change in test
Bram Moolenaar <Bram@vim.org>
parents: 30407
diff changeset
429 call writefile(content, 'Xtest_quit_message', 'D')
f85930a64d7b patch 9.0.0586: missing change in test
Bram Moolenaar <Bram@vim.org>
parents: 30407
diff changeset
430 let buf = RunVimInTerminal('-S Xtest_quit_message', #{rows: 10, wait_for_ruler: 0})
f85930a64d7b patch 9.0.0586: missing change in test
Bram Moolenaar <Bram@vim.org>
parents: 30407
diff changeset
431 call WaitForAssert({-> assert_match('^-- More --', term_getline(buf, 10))})
22592
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
432 call term_sendkeys(buf, "q")
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
433 call VerifyScreenDump(buf, 'Test_quit_long_message', {})
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
434
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
435 " clean up
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
436 call StopVimInTerminal(buf)
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
437 endfunc
fb5546aa6817 patch 8.2.1844: using "q" at the more prompt doesn't stop a long message
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
438
26642
7fe649a64777 patch 8.2.3850: illegal memory access when displaying a partial
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
439 " this was missing a terminating NUL
7fe649a64777 patch 8.2.3850: illegal memory access when displaying a partial
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
440 func Test_echo_string_partial()
7fe649a64777 patch 8.2.3850: illegal memory access when displaying a partial
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
441 function CountSpaces()
7fe649a64777 patch 8.2.3850: illegal memory access when displaying a partial
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
442 endfunction
26652
a3f38923c037 patch 8.2.3855: illegal memory access when displaying a blob
Bram Moolenaar <Bram@vim.org>
parents: 26642
diff changeset
443 call assert_equal("function('CountSpaces', [{'ccccccccccc': ['ab', 'cd'], 'aaaaaaaaaaa': v:false, 'bbbbbbbbbbbb': ''}])", string(function('CountSpaces', [#{aaaaaaaaaaa: v:false, bbbbbbbbbbbb: '', ccccccccccc: ['ab', 'cd']}])))
26642
7fe649a64777 patch 8.2.3850: illegal memory access when displaying a partial
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
444 endfunc
7fe649a64777 patch 8.2.3850: illegal memory access when displaying a partial
Bram Moolenaar <Bram@vim.org>
parents: 24134
diff changeset
445
27255
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
446 " Message output was previously overwritten by the fileinfo display, shown
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
447 " when switching buffers. If a buffer is switched to, then a message if
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
448 " echoed, we should show the message, rather than overwriting it with
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
449 " fileinfo.
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
450 func Test_fileinfo_after_echo()
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
451 CheckScreendump
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
452
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
453 let content =<< trim END
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
454 file a.txt
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
455
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
456 hide edit b.txt
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
457 call setline(1, "hi")
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
458 setlocal modified
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
459
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
460 hide buffer a.txt
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
461
28105
7824e49e5f51 patch 8.2.4577: message test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 27344
diff changeset
462 autocmd CursorHold * buf b.txt | w | echo "'b' written"
27255
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
463 END
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
464
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30543
diff changeset
465 call writefile(content, 'Xtest_fileinfo_after_echo', 'D')
27255
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
466 let buf = RunVimInTerminal('-S Xtest_fileinfo_after_echo', #{rows: 6})
28105
7824e49e5f51 patch 8.2.4577: message test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 27344
diff changeset
467 call term_sendkeys(buf, ":set updatetime=50\<CR>")
7824e49e5f51 patch 8.2.4577: message test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 27344
diff changeset
468 call term_sendkeys(buf, "0$")
27255
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
469 call VerifyScreenDump(buf, 'Test_fileinfo_after_echo', {})
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
470
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
471 call term_sendkeys(buf, ":q\<CR>")
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
472
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
473 " clean up
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
474 call StopVimInTerminal(buf)
27344
44e82999b4e1 patch 8.2.4200: some tests do not clean up properly
Bram Moolenaar <Bram@vim.org>
parents: 27255
diff changeset
475 call delete('b.txt')
27255
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
476 endfunc
8c43e3d1a6e5 patch 8.2.4156: fileinfo message overwrites echo'ed message
Bram Moolenaar <Bram@vim.org>
parents: 26652
diff changeset
477
29966
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
478 func Test_echowindow()
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
479 CheckScreendump
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
480
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
481 let lines =<< trim END
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
482 call setline(1, 'some text')
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
483 func ShowMessage(arg)
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
484 echowindow a:arg
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
485 endfunc
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
486 echowindow 'first line'
30027
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
487 func ManyMessages()
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
488 for n in range(20)
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
489 echowindow 'line' n
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
490 endfor
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
491 endfunc
30222
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
492
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
493 def TwoMessages()
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
494 popup_clear()
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
495 set cmdheight=2
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
496 redraw
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
497 timer_start(100, (_) => {
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
498 echowin 'message'
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
499 })
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
500 echo 'one'
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
501 echo 'two'
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
502 enddef
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
503
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
504 def ThreeMessages()
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
505 popup_clear()
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
506 redraw
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
507 timer_start(100, (_) => {
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
508 echowin 'later message'
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
509 })
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
510 echo 'one'
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
511 echo 'two'
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
512 echo 'three'
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
513 enddef
30697
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
514
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
515 def HideWin()
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
516 popup_hide(popup_findecho())
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
517 enddef
29966
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
518 END
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30543
diff changeset
519 call writefile(lines, 'XtestEchowindow', 'D')
29966
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
520 let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8})
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
521 call VerifyScreenDump(buf, 'Test_echowindow_1', {})
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
522
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
523 call term_sendkeys(buf, ":call ShowMessage('second line')\<CR>")
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
524 call VerifyScreenDump(buf, 'Test_echowindow_2', {})
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
525
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
526 call term_sendkeys(buf, ":call popup_clear()\<CR>")
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
527 call VerifyScreenDump(buf, 'Test_echowindow_3', {})
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
528
30027
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
529 call term_sendkeys(buf, ":call ManyMessages()\<CR>")
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
530 call VerifyScreenDump(buf, 'Test_echowindow_4', {})
7e787f94852b patch 9.0.0351: message window may obscure the command line
Bram Moolenaar <Bram@vim.org>
parents: 30005
diff changeset
531
30222
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
532 call term_sendkeys(buf, ":call TwoMessages()\<CR>")
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
533 call VerifyScreenDump(buf, 'Test_echowindow_5', {})
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
534
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
535 call term_sendkeys(buf, ":call ThreeMessages()\<CR>")
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
536 sleep 120m
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
537 call VerifyScreenDump(buf, 'Test_echowindow_6', {})
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
538
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
539 call term_sendkeys(buf, "\<CR>")
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
540 call VerifyScreenDump(buf, 'Test_echowindow_7', {})
b871016ea7c1 patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30190
diff changeset
541
30511
98bef0149214 patch 9.0.0591: message window popup shows on only one tab page
Bram Moolenaar <Bram@vim.org>
parents: 30501
diff changeset
542 call term_sendkeys(buf, ":tabnew\<CR>")
30697
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
543 call term_sendkeys(buf, ":7echowin 'more'\<CR>")
30511
98bef0149214 patch 9.0.0591: message window popup shows on only one tab page
Bram Moolenaar <Bram@vim.org>
parents: 30501
diff changeset
544 call VerifyScreenDump(buf, 'Test_echowindow_8', {})
98bef0149214 patch 9.0.0591: message window popup shows on only one tab page
Bram Moolenaar <Bram@vim.org>
parents: 30501
diff changeset
545
30697
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
546 call term_sendkeys(buf, ":call HideWin()\<CR>")
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
547 call VerifyScreenDump(buf, 'Test_echowindow_9', {})
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 30582
diff changeset
548
29966
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
549 " clean up
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
550 call StopVimInTerminal(buf)
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
551 endfunc
5dfd4bd66ad8 patch 9.0.0321: cannot use the message popup window directly
Bram Moolenaar <Bram@vim.org>
parents: 29938
diff changeset
552
30037
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
553 " messages window should not be used while evaluating the :echowin argument
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
554 func Test_echowin_eval()
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
555 CheckScreendump
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
556
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
557 let lines =<< trim END
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
558 func ShowMessage()
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
559 echo 123
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
560 return 'test'
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
561 endfunc
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
562 echowindow ShowMessage()
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
563 END
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30543
diff changeset
564 call writefile(lines, 'XtestEchowindow', 'D')
30037
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
565 let buf = RunVimInTerminal('-S XtestEchowindow', #{rows: 8})
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
566 call VerifyScreenDump(buf, 'Test_echowin_eval', {})
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
567
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
568 " clean up
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
569 call StopVimInTerminal(buf)
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
570 endfunc
c222a5a2a42a patch 9.0.0356: :echowindow sets the in_echowindow flag too early
Bram Moolenaar <Bram@vim.org>
parents: 30027
diff changeset
571
30190
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
572 " messages window should not be used for showing the mode
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
573 func Test_echowin_showmode()
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
574 CheckScreendump
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
575
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
576 let lines =<< trim END
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
577 vim9script
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
578 setline(1, ['one', 'two'])
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
579 timer_start(100, (_) => {
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
580 echowin 'echo window'
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
581 })
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
582 normal V
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
583 END
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
584 call writefile(lines, 'XtestEchowinMode', 'D')
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
585 let buf = RunVimInTerminal('-S XtestEchowinMode', #{rows: 8})
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
586 call VerifyScreenDump(buf, 'Test_echowin_showmode', {})
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
587
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
588 " clean up
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
589 call StopVimInTerminal(buf)
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
590 endfunc
c4af016733fe patch 9.0.0431: current mode shows in message window
Bram Moolenaar <Bram@vim.org>
parents: 30037
diff changeset
591
29912
c9ff1715f03d patch 9.0.0294: crash when 'cmdheight' is 0 and popup_clear() used
Bram Moolenaar <Bram@vim.org>
parents: 29910
diff changeset
592
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20126
diff changeset
593 " vim: shiftwidth=2 sts=2 expandtab