Mercurial > vim
annotate src/testdir/test_execute_func.vim @ 30643:dfb02f9dcbe8 v9.0.0656
patch 9.0.0656: cannot specify another character to use instead of '@'
Commit: https://github.com/vim/vim/commit/4ba5f1dab656103e8f4a4505452d1816b9e83c1e
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 4 14:36:29 2022 +0100
patch 9.0.0656: cannot specify another character to use instead of '@'
Problem: Cannot specify another character to use instead of '@' at the end
of the window.
Solution: Add "lastline" to 'fillchars'. (Martin Tournoij, closes #11264,
closes #10963)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 04 Oct 2022 15:45:03 +0200 |
parents | ea38db8639eb |
children | 239e20a09999 |
rev | line source |
---|---|
9454
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " test execute() |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
3 source view_util.vim |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4 source check.vim |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26994
diff
changeset
|
5 import './vim9.vim' as v9 |
26666
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
6 source term_util.vim |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
7 |
9454
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 func NestedEval() |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 let nested = execute('echo "nested\nlines"') |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 echo 'got: "' . nested . '"' |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 endfunc |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 func NestedRedir() |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 redir => var |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 echo 'broken' |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 redir END |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 func Test_execute_string() |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal("\nnocompatible", execute('set compatible?')) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal("\nsomething\nnice", execute('echo "something\nnice"')) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal("noendofline", execute('echon "noendofline"')) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal("", execute(123)) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal("\ngot: \"\nnested\nlines\"", execute('call NestedEval()')) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 redir => redired |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 echo 'this' |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 let evaled = execute('echo "that"') |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 echo 'theend' |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 redir END |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_equal("\nthis\ntheend", redired) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call assert_equal("\nthat", evaled) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 call assert_fails('call execute("doesnotexist")', 'E492:') |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call assert_fails('call execute("call NestedRedir()")', 'E930:') |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_equal("\nsomething", execute('echo "something"', '')) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 call assert_equal("\nsomething", execute('echo "something"', 'silent')) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 call assert_equal("\nsomething", execute('echo "something"', 'silent!')) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 call assert_equal("", execute('burp', 'silent!')) |
30310
029c59bf78f1
patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
41 call assert_fails('call execute(3.4)', 'E492:') |
029c59bf78f1
patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
42 call assert_equal("\nx", execute("echo \"x\"", 3.4)) |
029c59bf78f1
patch 9.0.0491: no good reason to build without the float feature
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
43 call v9.CheckDefExecAndScriptFailure(['execute("echo \"x\"", 3.4)'], ['E1013: Argument 2: type mismatch, expected string but got float', 'E1174:']) |
9454
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 endfunc |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 func Test_execute_list() |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call assert_equal("\nsomething\nnice", execute(['echo "something"', 'echo "nice"'])) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 let l = ['for n in range(0, 3)', |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 \ 'echo n', |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 \ 'endfor'] |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call assert_equal("\n0\n1\n2\n3", execute(l)) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call assert_equal("", execute([])) |
9da0cb39cbee
commit https://github.com/vim/vim/commit/79815f1ec77406f2f21a618c053e5793b597db7a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 endfunc |
15117
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
55 |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
56 func Test_execute_does_not_change_col() |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
57 echo '' |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
58 echon 'abcd' |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
59 let x = execute('silent echo 234343') |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
60 echon 'xyz' |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
61 let text = '' |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
62 for col in range(1, 7) |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
63 let text .= nr2char(screenchar(&lines, col)) |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
64 endfor |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
65 call assert_equal('abcdxyz', text) |
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
9454
diff
changeset
|
66 endfunc |
15121
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
67 |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
68 func Test_execute_not_silent() |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
69 echo '' |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
70 echon 'abcd' |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
71 let x = execute('echon 234', '') |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
72 echo 'xyz' |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
73 let text1 = '' |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
74 for col in range(1, 8) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
75 let text1 .= nr2char(screenchar(&lines - 1, col)) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
76 endfor |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
77 call assert_equal('abcd234 ', text1) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
78 let text2 = '' |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
79 for col in range(1, 4) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
80 let text2 .= nr2char(screenchar(&lines, col)) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
81 endfor |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
82 call assert_equal('xyz ', text2) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
83 endfunc |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
84 |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
85 func Test_win_execute() |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
86 let thiswin = win_getid() |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
87 new |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
88 let otherwin = win_getid() |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
89 call setline(1, 'the new window') |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
90 call win_gotoid(thiswin) |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
91 let line = win_execute(otherwin, 'echo getline(1)') |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
92 call assert_match('the new window', line) |
23596
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
93 let line = win_execute(134343, 'echo getline(1)') |
9fa72351c18f
patch 8.2.2340: win_execute() unexpectedly returns number zero when failing
Bram Moolenaar <Bram@vim.org>
parents:
20156
diff
changeset
|
94 call assert_equal('', line) |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
95 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18259
diff
changeset
|
96 if has('popupwin') |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
97 let popupwin = popup_create('the popup win', {'line': 2, 'col': 3}) |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
98 redraw |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17670
diff
changeset
|
99 let line = 'echo getline(1)'->win_execute(popupwin) |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
100 call assert_match('the popup win', line) |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
101 |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
102 call popup_close(popupwin) |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
103 endif |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
104 |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
105 call win_gotoid(otherwin) |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
106 bwipe! |
26121
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
107 |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
108 " check :lcd in another window does not change directory |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
109 let curid = win_getid() |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
110 let curdir = getcwd() |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
111 split Xother |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
112 lcd .. |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
113 " Use :pwd to get the actual current directory |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
114 let otherdir = execute('pwd') |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
115 call win_execute(curid, 'lcd testdir') |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
116 call assert_equal(otherdir, execute('pwd')) |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
117 bwipe! |
2c64a420ce7e
patch 8.2.3593: directory is wrong after executing "lcd" with win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
118 execute 'cd ' .. curdir |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
119 endfunc |
17670
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
120 |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
121 func Test_win_execute_update_ruler() |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
122 CheckFeature quickfix |
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
123 |
18259
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
124 enew |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
125 call setline(1, range(500)) |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
126 20 |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
127 split |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
128 let winid = win_getid() |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
129 set ruler |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
130 wincmd w |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
131 let height = winheight(winid) |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
132 redraw |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
133 call assert_match('20,1', Screenline(height + 1)) |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
134 let line = win_execute(winid, 'call cursor(100, 1)') |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
135 redraw |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
136 call assert_match('100,1', Screenline(height + 1)) |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
137 |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
138 bwipe! |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
139 endfunc |
f254dd2bc107
patch 8.1.2124: ruler is not updated if win_execute() moves cursor
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
140 |
17670
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
141 func Test_win_execute_other_tab() |
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
142 let thiswin = win_getid() |
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
143 tabnew |
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
144 call win_execute(thiswin, 'let xyz = 1') |
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
145 call assert_equal(1, xyz) |
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
146 tabclose |
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
147 unlet xyz |
1be29c149103
patch 8.1.1832: win_execute() does not work in other tab
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
148 endfunc |
19085
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
149 |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
150 func Test_win_execute_visual_redraw() |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
151 call setline(1, ['a', 'b', 'c']) |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
152 new |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
153 wincmd p |
26994
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
154 " start Visual in current window, redraw in other window with fewer lines |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
155 call feedkeys("G\<C-V>", 'txn') |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
156 call win_execute(winnr('#')->win_getid(), 'redraw') |
26994
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
157 call feedkeys("\<Esc>", 'txn') |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
158 bwipe! |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
159 bwipe! |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
160 |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
161 enew |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
162 new |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
163 call setline(1, ['a', 'b', 'c']) |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
164 let winid = win_getid() |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
165 wincmd p |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
166 " start Visual in current window, extend it in other window with more lines |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
167 call feedkeys("\<C-V>", 'txn') |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
168 call win_execute(winid, 'call feedkeys("G\<C-V>", ''txn'')') |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
169 redraw |
8d9506f3542e
patch 8.2.4026: ml_get error with specific win_execute() command
Bram Moolenaar <Bram@vim.org>
parents:
26978
diff
changeset
|
170 |
26978
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
171 bwipe! |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
172 bwipe! |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
173 endfunc |
aa613a3084b9
patch 8.2.4018: ml_get error when win_execute redraws with Visual selection
Bram Moolenaar <Bram@vim.org>
parents:
26666
diff
changeset
|
174 |
26666
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
175 func Test_win_execute_on_startup() |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
176 CheckRunVimInTerminal |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
177 |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
178 let lines =<< trim END |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
179 vim9script |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
180 [repeat('x', &columns)]->writefile('Xfile1') |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
181 silent tabedit Xfile2 |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
182 var id = win_getid() |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
183 silent tabedit Xfile3 |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
184 autocmd VimEnter * win_execute(id, 'close') |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
185 END |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30310
diff
changeset
|
186 call writefile(lines, 'XwinExecute', 'D') |
26666
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
187 let buf = RunVimInTerminal('-p Xfile1 -Nu XwinExecute', {}) |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
188 |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
189 " this was crashing on exit with EXITFREE defined |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
190 call StopVimInTerminal(buf) |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
191 |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
192 call delete('Xfile1') |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
193 endfunc |
bbcbb3c13fba
patch 8.2.3862: crash on exit with EXITFREE and using win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
26650
diff
changeset
|
194 |
20156
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
195 func Test_execute_func_with_null() |
19085
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
196 call assert_equal("", execute(test_null_string())) |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
197 call assert_equal("", execute(test_null_list())) |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
198 call assert_fails('call execute(test_null_dict())', 'E731:') |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
199 call assert_fails('call execute(test_null_blob())', 'E976:') |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
200 call assert_fails('call execute(test_null_partial())','E729:') |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
201 if has('job') |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
202 call assert_fails('call execute(test_null_job())', 'E908:') |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
203 call assert_fails('call execute(test_null_channel())', 'E908:') |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
204 endif |
fd1070ff696b
patch 8.2.0103: using null object with execute() has strange effects
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
205 endfunc |
20156
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
206 |
49694eceaa55
patch 8.2.0633: crash when using null partial in filter()
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
207 " vim: shiftwidth=2 sts=2 expandtab |