Browse Source

Fixed moving of selection while loading thumbnails

master
Bert 14 years ago
parent
commit
62f4ab037a
2 changed files with 4 additions and 5 deletions
  1. +3
    -3
      thumbs.c
  2. +1
    -2
      thumbs.h

+ 3
- 3
thumbs.c View File

@@ -32,7 +32,7 @@ void tns_init(tns_t *tns, int cnt) {
if (!tns) if (!tns)
return; 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)); 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; x += thumb_dim;
} }
} }
tns->vis = i - tns->first;


printf("%d, %d\n", tns->sel, tns->cnt);
tns_highlight(tns, win, -1); tns_highlight(tns, win, -1);
} }


@@ -166,7 +166,7 @@ void tns_move_selection(tns_t *tns, win_t *win, movedir_t dir) {
} }
break; break;
case MOVE_DOWN: 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->sel += tns->cols;
tns_highlight(tns, win, sel); tns_highlight(tns, win, sel);
} }


+ 1
- 2
thumbs.h View File

@@ -45,10 +45,9 @@ typedef struct tns_s {
int rows; int rows;
int first; int first;
int sel; int sel;
int vis;
} tns_t; } tns_t;


extern const int thumb_dim;

void tns_init(tns_t*, int); void tns_init(tns_t*, int);
void tns_free(tns_t*, win_t*); void tns_free(tns_t*, win_t*);




||||||
x
 
000:0
Loading…
Cancel
Save