Set global markidx whenever a single img is (un)marked

This also sets *markidx* when using the right mouse button in thumbnail mode.
This commit is contained in:
Bert Münnich 2018-06-09 14:06:16 +02:00
parent 5367b75867
commit 1de5f06f83
2 changed files with 4 additions and 4 deletions

View file

@ -194,7 +194,6 @@ bool cg_zoom(arg_t d)
bool cg_toggle_image_mark(arg_t _) bool cg_toggle_image_mark(arg_t _)
{ {
markidx = fileidx;
return mark_image(fileidx, !(files[fileidx].flags & FF_MARK)); return mark_image(fileidx, !(files[fileidx].flags & FF_MARK));
} }
@ -213,11 +212,11 @@ bool cg_reverse_marks(arg_t _)
bool cg_mark_range(arg_t _) bool cg_mark_range(arg_t _)
{ {
int i, d = fileidx < markidx ? 1 : -1; int d = markidx < fileidx ? 1 : -1;
bool dirty = false, on = !!(files[markidx].flags & FF_MARK); bool dirty = false, on = !!(files[markidx].flags & FF_MARK);
for (i = fileidx; i != markidx; i += d) { while (markidx != fileidx) {
if (mark_image(i, on)) if (mark_image(markidx + d, on))
dirty = true; dirty = true;
} }
return dirty; return dirty;

1
main.c
View file

@ -323,6 +323,7 @@ void load_image(int new)
bool mark_image(int n, bool on) bool mark_image(int n, bool on)
{ {
markidx = n;
if (!!(files[n].flags & FF_MARK) != on) { if (!!(files[n].flags & FF_MARK) != on) {
files[n].flags ^= FF_MARK; files[n].flags ^= FF_MARK;
markcnt += on ? 1 : -1; markcnt += on ? 1 : -1;