Fix reverse iteration in urlOpen
parent
bd48cb5e7d
commit
089647b6cd
4
url.c
4
url.c
|
@ -76,8 +76,8 @@ void urlOpen(struct Tag tag, size_t at, size_t to) {
|
||||||
size_t argc = 1;
|
size_t argc = 1;
|
||||||
char *argv[2 + RingLen] = { "open" };
|
char *argv[2 + RingLen] = { "open" };
|
||||||
size_t tagIndex = 0;
|
size_t tagIndex = 0;
|
||||||
for (size_t i = 0; i < RingLen; ++i) {
|
for (size_t i = RingLen - 1; i < RingLen; --i) {
|
||||||
struct Entry entry = ring.buf[(ring.end - i) & (RingLen - 1)];
|
struct Entry entry = ring.buf[(ring.end + i) & (RingLen - 1)];
|
||||||
if (!entry.url || entry.tag != tag.id) continue;
|
if (!entry.url || entry.tag != tag.id) continue;
|
||||||
if (tagIndex >= at && tagIndex < to) argv[argc++] = entry.url;
|
if (tagIndex >= at && tagIndex < to) argv[argc++] = entry.url;
|
||||||
tagIndex++;
|
tagIndex++;
|
||||||
|
|
Loading…
Reference in New Issue