mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
09ca932f8e
This commit is contained in:
parent
a466bd2927
commit
012cd35bfb
@ -8154,6 +8154,10 @@ static void ex_normal(exarg_T *eap)
|
|||||||
static void ex_startinsert(exarg_T *eap)
|
static void ex_startinsert(exarg_T *eap)
|
||||||
{
|
{
|
||||||
if (eap->forceit) {
|
if (eap->forceit) {
|
||||||
|
// cursor line can be zero on startup
|
||||||
|
if (!curwin->w_cursor.lnum) {
|
||||||
|
curwin->w_cursor.lnum = 1;
|
||||||
|
}
|
||||||
coladvance((colnr_T)MAXCOL);
|
coladvance((colnr_T)MAXCOL);
|
||||||
curwin->w_curswant = MAXCOL;
|
curwin->w_curswant = MAXCOL;
|
||||||
curwin->w_set_curswant = FALSE;
|
curwin->w_set_curswant = FALSE;
|
||||||
|
@ -264,3 +264,27 @@ func Test_default_term()
|
|||||||
call assert_match('nvim', out)
|
call assert_match('nvim', out)
|
||||||
let $TERM = save_term
|
let $TERM = save_term
|
||||||
endfunc
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user