summaryrefslogtreecommitdiff
path: root/src/testdir/test_terminal.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-14 14:22:28 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-14 14:22:28 +0100
commitf4d61bc559f8cb6adc4880183a4fd216865c0c30 (patch)
tree8eea642340fa2386f81208c97956522706d4907e /src/testdir/test_terminal.vim
parent2ce7790348dab9cbfcc5d02c8258d0dd7ecacf95 (diff)
downloadvim-git-f4d61bc559f8cb6adc4880183a4fd216865c0c30.tar.gz
patch 8.2.1983: ml_get error when using <Cmd> to open a terminalv8.2.1983
Problem: ml_get error when using <Cmd> to open a terminal. Solution: If the window changed reset the incsearch state. (closes #7289)
Diffstat (limited to 'src/testdir/test_terminal.vim')
-rw-r--r--src/testdir/test_terminal.vim25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 16ad720f7..137a8a605 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1200,7 +1200,30 @@ func Test_terminal_open_autocmd()
unlet s:called
au! repro
-endfunction
+endfunc
+
+func Test_open_term_from_cmd()
+ CheckUnix
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ call setline(1, ['a', 'b', 'c'])
+ 3
+ set incsearch
+ cnoremap <F3> <Cmd>call term_start(['/bin/sh', '-c', ':'])<CR>
+ END
+ call writefile(lines, 'Xopenterm')
+ let buf = RunVimInTerminal('-S Xopenterm', {})
+
+ " this opens a window, incsearch should not use the old cursor position
+ call term_sendkeys(buf, "/\<F3>")
+ call VerifyScreenDump(buf, 'Test_terminal_from_cmd', {})
+ call term_sendkeys(buf, "\<Esc>")
+ call term_sendkeys(buf, ":q\<CR>")
+
+ call StopVimInTerminal(buf)
+ call delete('Xopenterm')
+endfunc
func Check_dump01(off)
call assert_equal('one two three four five', trim(getline(a:off + 1)))