aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/misc1.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-08-26 15:20:59 +0200
committerGitHub <noreply@github.com>2018-08-26 15:20:59 +0200
commiteb663d53673c10fc5fe6af1cec354b1912780832 (patch)
tree3a0912ecbd1cf453c481c311541bdc262b248ff9 /src/nvim/misc1.c
parent8f058dca890ca9b9678e2435020f84a5f9c75acb (diff)
parent16b55d2e9d074bb3de7505708c30c05fe02d8f12 (diff)
downloadrneovim-eb663d53673c10fc5fe6af1cec354b1912780832.tar.gz
rneovim-eb663d53673c10fc5fe6af1cec354b1912780832.tar.bz2
rneovim-eb663d53673c10fc5fe6af1cec354b1912780832.zip
Merge #8903 from janlazo/vim-8.0.0883
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r--src/nvim/misc1.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index e87c754eb8..caaa310a8b 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -1605,11 +1605,19 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
char_u *oldp = ml_get(lnum);
colnr_T oldlen = (colnr_T)STRLEN(oldp);
- /*
- * Can't do anything when the cursor is on the NUL after the line.
- */
- if (col >= oldlen)
+ // Can't do anything when the cursor is on the NUL after the line.
+ if (col >= oldlen) {
+ return FAIL;
+ }
+ // If "count" is zero there is nothing to do.
+ if (count == 0) {
+ return OK;
+ }
+ // If "count" is negative the caller must be doing something wrong.
+ if (count < 1) {
+ IEMSGN("E950: Invalid count for del_bytes(): %ld", count);
return FAIL;
+ }
/* If 'delcombine' is set and deleting (less than) one character, only
* delete the last combining character. */