aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-07 19:28:15 -0700
committerGitHub <noreply@github.com>2019-09-07 19:28:15 -0700
commit3dbd94dafa25b6bd5a425b3a5b0c57ee196bde27 (patch)
tree208fa917f8051bc4eab0c8f749be41e77ef09311 /src/nvim/normal.c
parentdd7355358edc40734afcce695432756859377eb8 (diff)
parent15459f92551c9f20a0bd5625e8bd9a4259a6c16c (diff)
downloadrneovim-3dbd94dafa25b6bd5a425b3a5b0c57ee196bde27.tar.gz
rneovim-3dbd94dafa25b6bd5a425b3a5b0c57ee196bde27.tar.bz2
rneovim-3dbd94dafa25b6bd5a425b3a5b0c57ee196bde27.zip
Merge #10963 from janlazo/vim-8.1.1988
vim-patch:8.0.1550,8.1.{1716,1988}
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index e6a4c38c59..e7e6d2b365 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -7508,6 +7508,23 @@ static void nv_esc(cmdarg_T *cap)
restart_edit = 'a';
}
+// Move the cursor for the "A" command.
+void set_cursor_for_append_to_line(void)
+{
+ curwin->w_set_curswant = true;
+ if (ve_flags == VE_ALL) {
+ const int save_State = State;
+
+ // Pretend Insert mode here to allow the cursor on the
+ // character past the end of the line
+ State = INSERT;
+ coladvance((colnr_T)MAXCOL);
+ State = save_State;
+ } else {
+ curwin->w_cursor.col += (colnr_T)STRLEN(get_cursor_pos_ptr());
+ }
+}
+
/// Handle "A", "a", "I", "i" and <Insert> commands.
static void nv_edit(cmdarg_T *cap)
{
@@ -7529,18 +7546,8 @@ static void nv_edit(cmdarg_T *cap)
clearop(cap->oap);
} else if (!checkclearopq(cap->oap)) {
switch (cap->cmdchar) {
- case 'A': /* "A"ppend after the line */
- curwin->w_set_curswant = true;
- if (ve_flags == VE_ALL) {
- int save_State = State;
-
- /* Pretend Insert mode here to allow the cursor on the
- * character past the end of the line */
- State = INSERT;
- coladvance((colnr_T)MAXCOL);
- State = save_State;
- } else
- curwin->w_cursor.col += (colnr_T)STRLEN(get_cursor_pos_ptr());
+ case 'A': // "A"ppend after the line
+ set_cursor_for_append_to_line();
break;
case 'I': /* "I"nsert before the first non-blank */