Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Another way of fixing issue #25 #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions commands.c
Expand Up @@ -69,10 +69,7 @@ bool it_switch_mode(arg_t a) {
img.slideshow = false;
reset_timeout(slideshow);
}
if (fileidx < tns.cnt)
tns.sel = fileidx;
else
tns.sel = tns.cnt > 0 ? tns.cnt - 1 : 0;
tns.sel = fileidx;
tns.dirty = true;
mode = MODE_THUMB;
} else {
Expand Down
2 changes: 2 additions & 0 deletions main.c
Expand Up @@ -138,6 +138,8 @@ void remove_file(int n, bool manual) {
filecnt--;
if (n < tns.cnt)
tns.cnt--;
if (n < fileidx)
fileidx--;
}

void set_timeout(timeout_f handler, int time, bool overwrite) {
Expand Down
9 changes: 9 additions & 0 deletions thumbs.c
Expand Up @@ -35,6 +35,9 @@
void exif_auto_orientate(const fileinfo_t*);
#endif

extern fileinfo_t *files;
extern int fileidx;

const int thumb_dim = THUMB_SIZE + 10;
char *cache_dir = NULL;

Expand Down Expand Up @@ -362,6 +365,12 @@ void tns_render(tns_t *tns) {
}
}
tns->dirty = false;
for (i = 0; i < tns->cnt; i++) {
if (strcmp(tns->thumbs[i].file->path, files[fileidx].path) == 0) {
tns->sel = i;
break;
}
}
tns_highlight(tns, tns->sel, true);
}

Expand Down