degesch: make buffer index computation easier to follow
This commit is contained in:
parent
868e34d15c
commit
a5a0078def
|
@ -12858,8 +12858,9 @@ on_move_buffer_left (int count, int key, void *user_data)
|
||||||
struct app_context *ctx = user_data;
|
struct app_context *ctx = user_data;
|
||||||
int total = buffer_count (ctx);
|
int total = buffer_count (ctx);
|
||||||
int n = buffer_get_index (ctx, ctx->current_buffer) - count;
|
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 <= 0
|
||||||
buffer_move (ctx, ctx->current_buffer, (n - 1) % total + 1);
|
? (total + n % total)
|
||||||
|
: ((n - 1) % total + 1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue