summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2013-10-21 21:57:21 +0200
committerBert Münnich <ber.t@posteo.de>2013-10-21 21:57:21 +0200
commit450c1ed9b54de4d374bff80735c874bb6f7a4a0f (patch)
tree9d67d8ff630be22c641d2746aa4d3d49299dc828
parent1b089bc2fa36fdbd69af25a15ec5ee3e8963b80d (diff)
downloadnsxiv-450c1ed9b54de4d374bff80735c874bb6f7a4a0f.tar.zst
Fixed inconsistencies in navigation when removing invalid files
-rw-r--r--Makefile2
-rw-r--r--main.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index ae4586f..754ddce 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = git-20131005
+VERSION = git-20131021
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man
diff --git a/main.c b/main.c
index fb8b8b6..eac3574 100644
--- a/main.c
+++ b/main.c
@@ -160,6 +160,8 @@ void remove_file(int n, bool manual)
filecnt--;
if (n < tns.cnt)
tns.cnt--;
+ if (n < alternate)
+ alternate--;
}
void set_timeout(timeout_f handler, int time, bool overwrite)
@@ -287,15 +289,18 @@ void load_image(int new)
win_set_cursor(&win, CURSOR_WATCH);
+ if (new != fileidx)
+ alternate = fileidx;
+
img_close(&img, false);
while (!img_load(&img, &files[new])) {
remove_file(new, false);
if (new >= filecnt)
new = filecnt - 1;
+ else if (new < fileidx)
+ new--;
}
-
files[new].loaded = true;
- alternate = fileidx;
fileidx = new;
info.open = false;