patch 8.0.1151: "vim -c startinsert!" doesn't append
Problem: "vim -c startinsert!" doesn't append.
Solution: Correct line number on startup. (Christian Brabandt, closes #2117)
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index af2b3c1..6f67bfc 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -263,3 +263,27 @@
call assert_match("defaulting to 'ansi'", out)
let $TERM = save_term
endfunc
+
+func Test_zzz_startinsert()
+ " Test :startinsert
+ call writefile(['123456'], 'Xtestout')
+ let after = [
+ \ ':startinsert',
+ \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
+ \ ]
+ if RunVim([], after, 'Xtestout')
+ let lines = readfile('Xtestout')
+ call assert_equal(['foobar123456'], lines)
+ endif
+ " Test :startinsert!
+ call writefile(['123456'], 'Xtestout')
+ let after = [
+ \ ':startinsert!',
+ \ 'call feedkeys("foobar\<c-o>:wq\<cr>","t")'
+ \ ]
+ if RunVim([], after, 'Xtestout')
+ let lines = readfile('Xtestout')
+ call assert_equal(['123456foobar'], lines)
+ endif
+ call delete('Xtestout')
+endfunc