aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/undo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r--src/nvim/undo.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index f496c4199a..684a9cf99e 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -272,7 +272,7 @@ int u_inssub(linenr_T lnum)
*/
int u_savedel(linenr_T lnum, long nlines)
{
- return u_savecommon(curbuf, lnum - 1, lnum + nlines,
+ return u_savecommon(curbuf, lnum - 1, lnum + (linenr_T)nlines,
nlines == curbuf->b_ml.ml_line_count ? 2 : lnum, false);
}
@@ -2337,7 +2337,7 @@ static void u_undoredo(int undo, bool do_buf_event)
}
oldsize = bot - top - 1; // number of lines before undo
- newsize = uep->ue_size; // number of lines after undo
+ newsize = (linenr_T)uep->ue_size; // number of lines after undo
if (top < newlnum) {
/* If the saved cursor is somewhere in this undo block, move it to
@@ -2351,8 +2351,8 @@ static void u_undoredo(int undo, bool do_buf_event)
/* Use the first line that actually changed. Avoids that
* undoing auto-formatting puts the cursor in the previous
* line. */
- for (i = 0; i < newsize && i < oldsize; ++i) {
- if (STRCMP(uep->ue_array[i], ml_get(top + 1 + i)) != 0) {
+ for (i = 0; i < newsize && i < oldsize; i++) {
+ if (STRCMP(uep->ue_array[i], ml_get(top + 1 + (linenr_T)i)) != 0) {
break;
}
}
@@ -2360,7 +2360,7 @@ static void u_undoredo(int undo, bool do_buf_event)
newlnum = top;
curwin->w_cursor.lnum = newlnum + 1;
} else if (i < newsize) {
- newlnum = top + i;
+ newlnum = top + (linenr_T)i;
curwin->w_cursor.lnum = newlnum + 1;
}
}
@@ -2405,8 +2405,7 @@ static void u_undoredo(int undo, bool do_buf_event)
// Adjust marks
if (oldsize != newsize) {
- mark_adjust(top + 1, top + oldsize, (long)MAXLNUM,
- (long)newsize - (long)oldsize, kExtmarkNOOP);
+ mark_adjust(top + 1, top + oldsize, MAXLNUM, newsize - oldsize, kExtmarkNOOP);
if (curbuf->b_op_start.lnum > top + oldsize) {
curbuf->b_op_start.lnum += newsize - oldsize;
}
@@ -2916,7 +2915,7 @@ static void u_getbot(buf_T *buf)
* old line count subtracted from the current line count.
*/
extra = buf->b_ml.ml_line_count - uep->ue_lcount;
- uep->ue_bot = uep->ue_top + uep->ue_size + 1 + extra;
+ uep->ue_bot = uep->ue_top + (linenr_T)uep->ue_size + 1 + extra;
if (uep->ue_bot < 1 || uep->ue_bot > buf->b_ml.ml_line_count) {
iemsg(_("E440: undo line missing"));
uep->ue_bot = uep->ue_top + 1; // assume all lines deleted, will