diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2018-01-07 05:51:44 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2018-01-08 22:16:10 +0100 |
commit | a5a0078def40933a890b33a16def67d50264e6eb (patch) | |
tree | e59d5a1e22860aaebd16552793e445b61d8d8dbc /degesch.c | |
parent | 868e34d15cf17d8ebf761faffa9669ff77ed62ee (diff) | |
download | xK-a5a0078def40933a890b33a16def67d50264e6eb.tar.gz xK-a5a0078def40933a890b33a16def67d50264e6eb.tar.xz xK-a5a0078def40933a890b33a16def67d50264e6eb.zip |
degesch: make buffer index computation easier to follow
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; } |