Mercurial > vim
comparison src/ex_docmd.c @ 17984:2ea47dee7ddd v8.1.1988
patch 8.1.1988: :startinsert! does not work the same way as "A"
Commit: https://github.com/vim/vim/commit/8d3b51084a5bdcd2ee9e31bc03cba0d16c43d428
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 5 21:29:01 2019 +0200
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 https://github.com/vim/vim/issues/4896)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 05 Sep 2019 21:30:03 +0200 |
parents | 46f95606b9ec |
children | 1868ec23360e |
comparison
equal
deleted
inserted
replaced
17983:9814aa081796 | 17984:2ea47dee7ddd |
---|---|
7594 static void | 7594 static void |
7595 ex_startinsert(exarg_T *eap) | 7595 ex_startinsert(exarg_T *eap) |
7596 { | 7596 { |
7597 if (eap->forceit) | 7597 if (eap->forceit) |
7598 { | 7598 { |
7599 /* cursor line can be zero on startup */ | 7599 // cursor line can be zero on startup |
7600 if (!curwin->w_cursor.lnum) | 7600 if (!curwin->w_cursor.lnum) |
7601 curwin->w_cursor.lnum = 1; | 7601 curwin->w_cursor.lnum = 1; |
7602 coladvance((colnr_T)MAXCOL); | 7602 set_cursor_for_append_to_line(); |
7603 curwin->w_curswant = MAXCOL; | 7603 } |
7604 curwin->w_set_curswant = FALSE; | 7604 |
7605 } | 7605 // Ignore the command when already in Insert mode. Inserting an |
7606 | 7606 // expression register that invokes a function can do this. |
7607 /* Ignore the command when already in Insert mode. Inserting an | |
7608 * expression register that invokes a function can do this. */ | |
7609 if (State & INSERT) | 7607 if (State & INSERT) |
7610 return; | 7608 return; |
7611 | 7609 |
7612 if (eap->cmdidx == CMD_startinsert) | 7610 if (eap->cmdidx == CMD_startinsert) |
7613 restart_edit = 'a'; | 7611 restart_edit = 'a'; |
7618 | 7616 |
7619 if (!eap->forceit) | 7617 if (!eap->forceit) |
7620 { | 7618 { |
7621 if (eap->cmdidx == CMD_startinsert) | 7619 if (eap->cmdidx == CMD_startinsert) |
7622 restart_edit = 'i'; | 7620 restart_edit = 'i'; |
7623 curwin->w_curswant = 0; /* avoid MAXCOL */ | 7621 curwin->w_curswant = 0; // avoid MAXCOL |
7624 } | 7622 } |
7625 } | 7623 } |
7626 | 7624 |
7627 /* | 7625 /* |
7628 * ":stopinsert" | 7626 * ":stopinsert" |