summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ops.c b/src/ops.c
index 8752477e..e8820517 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -5404,6 +5404,7 @@ do_addsub(command, Prenum1, g_cmd)
int lnum = curwin->w_cursor.lnum;
int lnume = curwin->w_cursor.lnum;
int startcol;
+ int did_change = FALSE;
dohex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); /* "heX" */
dooct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); /* "Octal" */
@@ -5547,6 +5548,7 @@ do_addsub(command, Prenum1, g_cmd)
#endif
}
curwin->w_cursor.col = col;
+ did_change = TRUE;
(void)del_char(FALSE);
ins_char(firstdigit);
}
@@ -5619,6 +5621,7 @@ do_addsub(command, Prenum1, g_cmd)
* Delete the old number.
*/
curwin->w_cursor.col = col;
+ did_change = TRUE;
todel = length;
c = gchar_cursor();
@@ -5713,7 +5716,8 @@ do_addsub(command, Prenum1, g_cmd)
RLADDSUBFIX(ptr);
#endif
}
- --curwin->w_cursor.col;
+ if (did_change && curwin->w_cursor.col > 0)
+ --curwin->w_cursor.col;
return OK;
}