diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2018-08-22 13:33:06 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-08-22 19:33:06 +0200 |
commit | 012cd35bfbe2c175a31a2fba14cf1bdee6f06e8c (patch) | |
tree | 00762eefa412c2d83d77c3bfc0d08bd45077e83a | |
parent | a466bd2927c9d15071aba425a01f11435ae4bbd2 (diff) | |
download | rneovim-012cd35bfbe2c175a31a2fba14cf1bdee6f06e8c.tar.gz rneovim-012cd35bfbe2c175a31a2fba14cf1bdee6f06e8c.tar.bz2 rneovim-012cd35bfbe2c175a31a2fba14cf1bdee6f06e8c.zip |
vim-patch:8.0.1151: "vim -c startinsert!" doesn't append (#8886)
Problem: "vim -c startinsert!" doesn't append.
Solution: Correct line number on startup. (Christian Brabandt, closes vim/vim#2117)
https://github.com/vim/vim/commit/09ca932f8e7d63a83b39baa7c03d4c6145e3baab
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_startup.vim | 24 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index b22f799da0..5a92a85c97 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8154,6 +8154,10 @@ static void ex_normal(exarg_T *eap) static void ex_startinsert(exarg_T *eap) { if (eap->forceit) { + // cursor line can be zero on startup + if (!curwin->w_cursor.lnum) { + curwin->w_cursor.lnum = 1; + } coladvance((colnr_T)MAXCOL); curwin->w_curswant = MAXCOL; curwin->w_set_curswant = FALSE; diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 7b77402115..638c6802d4 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -264,3 +264,27 @@ func Test_default_term() call assert_match('nvim', 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 |