diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-09-06 23:01:25 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-09-06 23:27:14 -0400 |
commit | a96b3677c689c8382dde20cb8919bf0dab12a3aa (patch) | |
tree | f9d166b2b9d3dfcf3c49e160ed01cd62da9524d4 /src/nvim/ex_docmd.c | |
parent | 158b78062e9daa65203b4591dae733dd6c11ad2c (diff) | |
download | rneovim-a96b3677c689c8382dde20cb8919bf0dab12a3aa.tar.gz rneovim-a96b3677c689c8382dde20cb8919bf0dab12a3aa.tar.bz2 rneovim-a96b3677c689c8382dde20cb8919bf0dab12a3aa.zip |
vim-patch:8.1.1988: :startinsert! does not work the same way as "A"
Problem: :startinsert! does not work the same way as "A".
Solution: Use the same code to move the cursor. (closes vim/vim#4896)
https://github.com/vim/vim/commit/8d3b51084a5bdcd2ee9e31bc03cba0d16c43d428
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index b97c886094..d524c3d035 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8305,15 +8305,14 @@ static void ex_startinsert(exarg_T *eap) if (!curwin->w_cursor.lnum) { curwin->w_cursor.lnum = 1; } - coladvance((colnr_T)MAXCOL); - curwin->w_curswant = MAXCOL; - curwin->w_set_curswant = FALSE; + set_cursor_for_append_to_line(); } - /* Ignore the command when already in Insert mode. Inserting an - * expression register that invokes a function can do this. */ - if (State & INSERT) + // Ignore the command when already in Insert mode. Inserting an + // expression register that invokes a function can do this. + if (State & INSERT) { return; + } if (eap->cmdidx == CMD_startinsert) restart_edit = 'a'; @@ -8325,7 +8324,7 @@ static void ex_startinsert(exarg_T *eap) if (!eap->forceit) { if (eap->cmdidx == CMD_startinsert) restart_edit = 'i'; - curwin->w_curswant = 0; /* avoid MAXCOL */ + curwin->w_curswant = 0; // avoid MAXCOL } if (VIsual_active) { |