From a5a0078def40933a890b33a16def67d50264e6eb Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sun, 7 Jan 2018 05:51:44 +0100
Subject: degesch: make buffer index computation easier to follow
---
degesch.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/degesch.c b/degesch.c
index 30fa19b..5908cfe 100644
--- a/degesch.c
+++ b/degesch.c
@@ -12858,8 +12858,9 @@ on_move_buffer_left (int count, int key, void *user_data)
struct app_context *ctx = user_data;
int total = buffer_count (ctx);
int n = buffer_get_index (ctx, ctx->current_buffer) - count;
- if (n <= 0) n += total * (1 + -n / total);
- buffer_move (ctx, ctx->current_buffer, (n - 1) % total + 1);
+ buffer_move (ctx, ctx->current_buffer, n <= 0
+ ? (total + n % total)
+ : ((n - 1) % total + 1));
return true;
}
--
cgit v1.2.3-70-g09d2