aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ops.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 1bba1154f2..5325beb654 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -296,19 +296,19 @@ void shift_line(bool left, bool round, int amount, int call_changed_bytes)
} else {
i += amount;
}
- count = i * sw_val;
+ count = (int64_t)i * (int64_t)sw_val;
} else { // original vi indent
if (left) {
- count = MAX(count - sw_val * amount, 0);
+ count = MAX(count - (int64_t)sw_val * (int64_t)amount, 0);
} else {
- if ((int64_t)sw_val * (int64_t)amount > INT_MAX - count) {
- count = INT_MAX;
- } else {
- count += (int64_t)sw_val * (int64_t)amount;
- }
+ count += (int64_t)sw_val * (int64_t)amount;
}
}
+ if (count > INT_MAX) {
+ count = INT_MAX;
+ }
+
// Set new indent
if (State & VREPLACE_FLAG) {
change_indent(INDENT_SET, (int)count, false, call_changed_bytes);