Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Another way of fixing issue #25 #26

Closed
wants to merge 1 commit into from

2 participants

@xaizek

Select current file after entering thumbnail mode.

I used files array and fileidx variable in thumbs.c, maybe it's bad and new for loop should be moved to some other unit (I couldn't pick one).

@xaizek xaizek Better way of fixing issue #25
Select current file after entering thumbnail mode.
b4e1a60
@muennich
Owner

Thanks for bringing this up. The behaviour is better, but your code is a bit hackish. Commit 71a7940 results in the same behaviour, but is a bit more elegant.

@muennich muennich closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 31, 2011
  1. @xaizek

    Better way of fixing issue #25

    xaizek authored
    Select current file after entering thumbnail mode.
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 4 deletions.
  1. +1 −4 commands.c
  2. +2 −0  main.c
  3. +9 −0 thumbs.c
View
5 commands.c
@@ -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 {
View
2  main.c
@@ -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) {
View
9 thumbs.c
@@ -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;
@@ -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);
}
Something went wrong with that request. Please try again.