about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-09-08 00:14:15 -0400
committerJune McEnroe <june@causal.agency>2018-09-08 00:14:15 -0400
commit089647b6cd4c3684665a74a61cd0d64d26939f5e (patch)
treed9d8885263ab8b64472fbba7d4bae78635d04459
parentMove event loop to event.c (diff)
downloadtest-089647b6cd4c3684665a74a61cd0d64d26939f5e.tar.gz
test-089647b6cd4c3684665a74a61cd0d64d26939f5e.zip
Fix reverse iteration in urlOpen
-rw-r--r--url.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/url.c b/url.c
index 3f8d57a..49bea65 100644
--- a/url.c
+++ b/url.c
@@ -76,8 +76,8 @@ void urlOpen(struct Tag tag, size_t at, size_t to) {
 	size_t argc = 1;
 	char *argv[2 + RingLen] = { "open" };
 	size_t tagIndex = 0;
-	for (size_t i = 0; i < RingLen; ++i) {
-		struct Entry entry = ring.buf[(ring.end - i) & (RingLen - 1)];
+	for (size_t i = RingLen - 1; i < RingLen; --i) {
+		struct Entry entry = ring.buf[(ring.end + i) & (RingLen - 1)];
 		if (!entry.url || entry.tag != tag.id) continue;
 		if (tagIndex >= at && tagIndex < to) argv[argc++] = entry.url;
 		tagIndex++;
20:20:19 -0500'>2022-02-19Factor out input handling to input.cJune McEnroe 2022-02-19Factor out window management to window.cJune McEnroe 2022-02-19Enable -Wmissing-prototypesJune McEnroe In other words, warn when a function is missing static. I don't see why this isn't in -Wextra. 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe I know, it feels wrong. 2022-02-18Implement new line editing "library"June McEnroe Losing tab complete and text macros, for now. This new implementation works on an instance of a struct and does not interact with the rest of catgirl, making it possible to copy into another project. Unlike existing line editing libraries, this one is entirely abstract and can be rendered externally. My goal with this library is to be able to implement vi mode. Since it operates on struct instances rather than globals, it might also be possible to give catgirl separate line editing buffers for each window, which would be a nice UX improvement. 2022-02-18Simplify cursor positioning in inputJune McEnroe Do some extra work by adding the portion before the cursor to the input window twice, but simplify the interaction with the split point. This fixes the awkward behaviour when moving the cursor across colour codes where the code would be partially interpreted up to the cursor. 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe