aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-23 22:49:57 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-23 23:00:06 -0500
commitab5083b5fc9fc8c62dae6aefc4fb2615a61c6fff (patch)
tree390d832a3ba5097718141f87a19eb1a9e789d927 /src/nvim/edit.c
parentceed85ea431b8fb4f694e4fca09f97e2a22f69d9 (diff)
downloadrneovim-ab5083b5fc9fc8c62dae6aefc4fb2615a61c6fff.tar.gz
rneovim-ab5083b5fc9fc8c62dae6aefc4fb2615a61c6fff.tar.bz2
rneovim-ab5083b5fc9fc8c62dae6aefc4fb2615a61c6fff.zip
pos: define MAXCOL to INT_MAX
Partial port of patch v8.1.0953. Remove useless casts on MAXCOL.
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);