nsxiv450c1ed
Fixed inconsistencies in navigation when removing invalid files
+8 −3
2 files changed
| @@ -1,4 +1,4 @@ | |||
| 1 | − | VERSION = git-20131005 | |
| 1 | + | VERSION = git-20131021 | |
| 2 | 2 | ||
| 3 | 3 | PREFIX = /usr/local | |
| 4 | 4 | MANPREFIX = $(PREFIX)/share/man | |
| @@ -160,6 +160,8 @@ void remove_file(int n, bool manual) | |||
| 160 | 160 | filecnt--; | |
| 161 | 161 | if (n < tns.cnt) | |
| 162 | 162 | tns.cnt--; | |
| 163 | + | if (n < alternate) | |
| 164 | + | alternate--; | |
| 163 | 165 | } | |
| 164 | 166 | ||
| 165 | 167 | void set_timeout(timeout_f handler, int time, bool overwrite) | |
| @@ -287,15 +289,18 @@ void load_image(int new) | |||
| 287 | 289 | ||
| 288 | 290 | win_set_cursor(&win, CURSOR_WATCH); | |
| 289 | 291 | ||
| 292 | + | if (new != fileidx) | |
| 293 | + | alternate = fileidx; | |
| 294 | + | ||
| 290 | 295 | img_close(&img, false); | |
| 291 | 296 | while (!img_load(&img, &files[new])) { | |
| 292 | 297 | remove_file(new, false); | |
| 293 | 298 | if (new >= filecnt) | |
| 294 | 299 | new = filecnt - 1; | |
| 300 | + | else if (new < fileidx) | |
| 301 | + | new--; | |
| 295 | 302 | } | |
| 296 | − | ||
| 297 | 303 | files[new].loaded = true; | |
| 298 | − | alternate = fileidx; | |
| 299 | 304 | fileidx = new; | |
| 300 | 305 | ||
| 301 | 306 | info.open = false; | |