Krolyxon
Commit 450c1ed

Branches

Refs →

nsxiv450c1ed

Fixed inconsistencies in navigation when removing invalid files

Author
Bert Münnich
Date
2013-10-21 21:57 +0200
Parent
1b089bc
Commit
450c1ed9b54de4d374bff80735c874bb6f7a4a0f

+8 −3

2 files changed

  1. M Makefile +1 −1
  2. M main.c +7 −2
M Makefile View
@@ -1,4 +1,4 @@
1−VERSION = git-20131005
1+VERSION = git-20131021
22
33 PREFIX = /usr/local
44 MANPREFIX = $(PREFIX)/share/man
M main.c View
@@ -160,6 +160,8 @@ void remove_file(int n, bool manual)
160160 filecnt--;
161161 if (n < tns.cnt)
162162 tns.cnt--;
163+ if (n < alternate)
164+ alternate--;
163165 }
164166
165167 void set_timeout(timeout_f handler, int time, bool overwrite)
@@ -287,15 +289,18 @@ void load_image(int new)
287289
288290 win_set_cursor(&win, CURSOR_WATCH);
289291
292+ if (new != fileidx)
293+ alternate = fileidx;
294+
290295 img_close(&img, false);
291296 while (!img_load(&img, &files[new])) {
292297 remove_file(new, false);
293298 if (new >= filecnt)
294299 new = filecnt - 1;
300+ else if (new < fileidx)
301+ new--;
295302 }
296−
297303 files[new].loaded = true;
298− alternate = fileidx;
299304 fileidx = new;
300305
301306 info.open = false;