nsxiv5b64679
Made remote changes adhere to code style
+9 −7
1 file changed
- M thumbs.c +9 −7
| @@ -390,27 +390,29 @@ void tns_highlight(tns_t *tns, int n, bool hl) { | |||
| 390 | 390 | } | |
| 391 | 391 | } | |
| 392 | 392 | ||
| 393 | − | bool tns_move_selection(tns_t *tns, direction_t dir, int count) { | |
| 394 | − | int old; | |
| 395 | − | int c = (count > 0 ? count : 1); | |
| 393 | + | bool tns_move_selection(tns_t *tns, direction_t dir, int cnt) { | |
| 394 | + | int old, max; | |
| 396 | 395 | ||
| 397 | 396 | if (tns == NULL || tns->thumbs == NULL) | |
| 398 | 397 | return false; | |
| 399 | 398 | ||
| 400 | 399 | old = tns->sel; | |
| 400 | + | cnt = cnt > 1 ? cnt : 1; | |
| 401 | 401 | ||
| 402 | 402 | switch (dir) { | |
| 403 | 403 | case DIR_UP: | |
| 404 | − | tns->sel = MAX(tns->sel - c * tns->cols, tns->sel % tns->cols); | |
| 404 | + | tns->sel = MAX(tns->sel - cnt * tns->cols, tns->sel % tns->cols); | |
| 405 | 405 | break; | |
| 406 | 406 | case DIR_DOWN: | |
| 407 | − | tns->sel = MIN(tns->sel + c * tns->cols, tns->cols * ((tns->cnt - 1) / tns->cols) + MIN((tns->cnt - 1) % tns->cols, tns->sel % tns->cols)); | |
| 407 | + | max = tns->cols * ((tns->cnt - 1) / tns->cols) + | |
| 408 | + | MIN((tns->cnt - 1) % tns->cols, tns->sel % tns->cols); | |
| 409 | + | tns->sel = MIN(tns->sel + cnt * tns->cols, max); | |
| 408 | 410 | break; | |
| 409 | 411 | case DIR_LEFT: | |
| 410 | − | tns->sel = MAX(tns->sel - c, 0); | |
| 412 | + | tns->sel = MAX(tns->sel - cnt, 0); | |
| 411 | 413 | break; | |
| 412 | 414 | case DIR_RIGHT: | |
| 413 | − | tns->sel = MIN(tns->sel + c, tns->cnt - 1); | |
| 415 | + | tns->sel = MIN(tns->sel + cnt, tns->cnt - 1); | |
| 414 | 416 | break; | |
| 415 | 417 | } | |
| 416 | 418 | ||