diff options
author | Sha Liu <dev.xinkele@gmail.com> | 2018-12-06 22:27:25 +0800 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-06-03 00:12:01 -0400 |
commit | 73a2922413b4fd119fc0ec1cca06ba0982ad576a (patch) | |
tree | 810ba84d4a04a76f20c92df2ddd5cbd75929a928 /test/functional/eval/execute_spec.lua | |
parent | 7443da6f6e819cbe0c4432a44a596de54c64b3d8 (diff) | |
download | rneovim-73a2922413b4fd119fc0ec1cca06ba0982ad576a.tar.gz rneovim-73a2922413b4fd119fc0ec1cca06ba0982ad576a.tar.bz2 rneovim-73a2922413b4fd119fc0ec1cca06ba0982ad576a.zip |
UI: Fix wrong msg_col after execute()
closes #6035
closes #9250
Diffstat (limited to 'test/functional/eval/execute_spec.lua')
-rw-r--r-- | test/functional/eval/execute_spec.lua | 134 |
1 files changed, 133 insertions, 1 deletions
diff --git a/test/functional/eval/execute_spec.lua b/test/functional/eval/execute_spec.lua index af37ab8d55..6f82b0d99c 100644 --- a/test/functional/eval/execute_spec.lua +++ b/test/functional/eval/execute_spec.lua @@ -125,9 +125,141 @@ describe('execute()', function() feed('<CR>') end) + it('places cursor correctly #6035', function() + local screen = Screen.new(40, 5) + screen:attach() + source([=[ + " test 1 + function! Test1a() + echo 12345678 + let x = execute('echo 1234567890', '') + echon '1234' + endfunction + + function! Test1b() + echo 12345678 + echo 1234567890 + echon '1234' + endfunction + + " test 2 + function! Test2a() + echo 12345678 + let x = execute('echo 1234567890', 'silent') + echon '1234' + endfunction + + function! Test2b() + echo 12345678 + silent echo 1234567890 + echon '1234' + endfunction + + " test 3 + function! Test3a() + echo 12345678 + let x = execute('echoerr 1234567890', 'silent!') + echon '1234' + endfunction + + function! Test3b() + echo 12345678 + silent! echoerr 1234567890 + echon '1234' + endfunction + + " test 4 + function! Test4a() + echo 12345678 + let x = execute('echoerr 1234567890', 'silent') + echon '1234' + endfunction + + function! Test4b() + echo 12345678 + silent echoerr 1234567890 + echon '1234' + endfunction + ]=]) + + feed([[:call Test1a()<cr>]]) + screen:expect([[ + | + | + 12345678 | + 12345678901234 | + Press ENTER or type command to continue^ | + ]]) + + feed([[:call Test1b()<cr>]]) + screen:expect([[ + 12345678 | + 12345678901234 | + 12345678 | + 12345678901234 | + Press ENTER or type command to continue^ | + ]]) + + feed([[:call Test2a()<cr>]]) + screen:expect([[ + 12345678901234 | + 12345678 | + 12345678901234 | + 123456781234 | + Press ENTER or type command to continue^ | + ]]) + + feed([[:call Test2b()<cr>]]) + screen:expect([[ + 12345678 | + 12345678901234 | + 123456781234 | + 123456781234 | + Press ENTER or type command to continue^ | + ]]) + + feed([[:call Test3a()<cr>]]) + screen:expect([[ + 12345678901234 | + 123456781234 | + 123456781234 | + 123456781234 | + Press ENTER or type command to continue^ | + ]]) + + feed([[:call Test3b()<cr>]]) + screen:expect([[ + 123456781234 | + 123456781234 | + 123456781234 | + 123456781234 | + Press ENTER or type command to continue^ | + ]]) + + feed([[:call Test4a()<cr>]]) + screen:expect([[ + Error detected while processing function| + Test4a: | + line 2: | + 123456781234 | + Press ENTER or type command to continue^ | + ]]) + + feed([[:call Test4b()<cr>]]) + screen:expect([[ + Error detected while processing function| + Test4b: | + line 2: | + 12345678901234 | + Press ENTER or type command to continue^ | + ]]) + + + end) + -- This deviates from vim behavior, but is consistent -- with how nvim currently displays the output. - it('does capture shell-command output', function() + it('captures shell-command output', function() local win_lf = iswin() and '\13' or '' eq('\n:!echo foo\r\n\nfoo'..win_lf..'\n', funcs.execute('!echo foo')) end) |