summaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-18 15:21:13 +0100
committerBert <ber.t@gmx.com>2011-02-18 15:21:13 +0100
commit62f4ab037aad918d5b6c92b423e54f29b5c1ecf8 (patch)
tree2eccd565e1d0357aa29dcc4e94961fe7115c393c /thumbs.c
parent637be490753ff107e1c43a1c69a786ada6b02e2c (diff)
downloadnsxiv-62f4ab037aad918d5b6c92b423e54f29b5c1ecf8.tar.zst
Fixed moving of selection while loading thumbnails
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/thumbs.c b/thumbs.c
index 3f187fc..ae12614 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -32,7 +32,7 @@ void tns_init(tns_t *tns, int cnt) {
if (!tns)
return;
- tns->cnt = tns->first = tns->sel = 0;
+ tns->cnt = tns->first = tns->sel = tns->vis = 0;
tns->thumbs = (thumb_t*) s_malloc(cnt * sizeof(thumb_t));
}
@@ -115,8 +115,8 @@ void tns_render(tns_t *tns, win_t *win) {
x += thumb_dim;
}
}
+ tns->vis = i - tns->first;
- printf("%d, %d\n", tns->sel, tns->cnt);
tns_highlight(tns, win, -1);
}
@@ -166,7 +166,7 @@ void tns_move_selection(tns_t *tns, win_t *win, movedir_t dir) {
}
break;
case MOVE_DOWN:
- if (sel / tns->cols < tns->rows - 1 && sel + tns->cols < tns->cnt) {
+ if (sel / tns->cols < tns->rows - 1 && sel + tns->cols < tns->vis) {
tns->sel += tns->cols;
tns_highlight(tns, win, sel);
}