aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-24 09:26:17 -0500
committerGitHub <noreply@github.com>2021-02-24 09:26:17 -0500
commitd290da70b76a2dcd99591ec1a175a4ae29f64bfd (patch)
treeff1820ca53dfe5484414a643339f8d136d7f0ceb /src/nvim/edit.c
parent6b7cc45c4845624aa08232a860941b5a55b9640b (diff)
parentab5083b5fc9fc8c62dae6aefc4fb2615a61c6fff (diff)
downloadrneovim-d290da70b76a2dcd99591ec1a175a4ae29f64bfd.tar.gz
rneovim-d290da70b76a2dcd99591ec1a175a4ae29f64bfd.tar.bz2
rneovim-d290da70b76a2dcd99591ec1a175a4ae29f64bfd.zip
Merge pull request #14001 from janlazo/vim-8.2.2545
vim-patch:8.2.{2545,2547,2548}
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 100e88e261..53717229f6 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1627,11 +1627,11 @@ static void init_prompt(int cmdchar_todo)
ml_append(curbuf->b_ml.ml_line_count, prompt, 0, false);
}
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
- coladvance((colnr_T)MAXCOL);
+ coladvance(MAXCOL);
changed_bytes(curbuf->b_ml.ml_line_count, 0);
}
if (cmdchar_todo == 'A') {
- coladvance((colnr_T)MAXCOL);
+ coladvance(MAXCOL);
}
if (cmdchar_todo == 'I' || curwin->w_cursor.col <= (int)STRLEN(prompt)) {
curwin->w_cursor.col = STRLEN(prompt);
@@ -6246,9 +6246,10 @@ void auto_format(
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
// "cannot happen"
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
- coladvance((colnr_T)MAXCOL);
- } else
+ coladvance(MAXCOL);
+ } else {
check_cursor_col();
+ }
// Insert mode: If the cursor is now after the end of the line while it
// previously wasn't, the line was broken. Because of the rule above we
@@ -8432,8 +8433,8 @@ static void ins_left(void)
// if 'whichwrap' set for cursor in insert mode may go to previous line.
// always break undo when moving upwards/downwards, else undo may break
start_arrow(&tpos);
- --(curwin->w_cursor.lnum);
- coladvance((colnr_T)MAXCOL);
+ curwin->w_cursor.lnum--;
+ coladvance(MAXCOL);
curwin->w_set_curswant = true; // so we stay at the end
} else {
vim_beep(BO_CRSR);
@@ -8467,7 +8468,7 @@ static void ins_end(int c)
tpos = curwin->w_cursor;
if (c == K_C_END)
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
- coladvance((colnr_T)MAXCOL);
+ coladvance(MAXCOL);
curwin->w_curswant = MAXCOL;
start_arrow(&tpos);