code-style: don't indent switch cases (#358)

The suckless coding style [^0] and the linux coding style [^1] both
recommends not indenting switch cases. And it helps out people with
lower resolution monitors.

[^0]: https://suckless.org/coding_style/
[^1]: https://www.kernel.org/doc/html/v5.10/process/coding-style.html#indentation

Co-authored-by: explosion-mental <explosion0mental@gmail.com>
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/358
Reviewed-by: NRK <nrk@disroot.org>
Co-authored-by: explosion-mental <explosion-mental@noreply.codeberg.org>
Co-committed-by: explosion-mental <explosion-mental@noreply.codeberg.org>
This commit is contained in:
explosion-mental
2022-08-16 10:54:31 +02:00
committed by NRK
parent 6578e6eb65
commit 0f0c49a630
4 changed files with 197 additions and 198 deletions

View File

@ -505,20 +505,20 @@ bool tns_move_selection(tns_t *tns, direction_t dir, int cnt)
cnt = cnt > 1 ? cnt : 1;
switch (dir) {
case DIR_UP:
*tns->sel = MAX(*tns->sel - cnt * tns->cols, *tns->sel % tns->cols);
break;
case DIR_DOWN:
max = tns->cols * ((*tns->cnt - 1) / tns->cols) +
MIN((*tns->cnt - 1) % tns->cols, *tns->sel % tns->cols);
*tns->sel = MIN(*tns->sel + cnt * tns->cols, max);
break;
case DIR_LEFT:
*tns->sel = MAX(*tns->sel - cnt, 0);
break;
case DIR_RIGHT:
*tns->sel = MIN(*tns->sel + cnt, *tns->cnt - 1);
break;
case DIR_UP:
*tns->sel = MAX(*tns->sel - cnt * tns->cols, *tns->sel % tns->cols);
break;
case DIR_DOWN:
max = tns->cols * ((*tns->cnt - 1) / tns->cols) +
MIN((*tns->cnt - 1) % tns->cols, *tns->sel % tns->cols);
*tns->sel = MIN(*tns->sel + cnt * tns->cols, max);
break;
case DIR_LEFT:
*tns->sel = MAX(*tns->sel - cnt, 0);
break;
case DIR_RIGHT:
*tns->sel = MIN(*tns->sel + cnt, *tns->cnt - 1);
break;
}
if (*tns->sel != old) {