summary refs log tree commit diff
path: root/url.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-12 23:44:58 -0400
committerJune McEnroe <june@causal.agency>2018-08-12 23:44:58 -0400
commit19464369c3612ff8f431a2bed62861f4d20cabc4 (patch)
treeea395f5e50b548834fe085bf36b7fff09d1abbcc /url.c
parentAvoid setting mark if switching to the same view (diff)
downloadcatgirl-19464369c3612ff8f431a2bed62861f4d20cabc4.tar.gz
catgirl-19464369c3612ff8f431a2bed62861f4d20cabc4.zip
Fix /open ranges by passing all URLs to open(1)
This is going to be incompatible with xdg-open since it takes only one
URL at a time. Write a wrapper script.
Diffstat (limited to '')
-rw-r--r--url.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/url.c b/url.c
index b7172ce..3a7628f 100644
--- a/url.c
+++ b/url.c
@@ -72,14 +72,15 @@ void urlList(struct Tag tag) {
 	}
 }
 
-void urlOpen(struct Tag tag, size_t fromEnd) {
-	size_t count = 0;
+void urlOpen(struct Tag tag, size_t at, size_t to) {
+	size_t argc = 1;
+	char *argv[2 + RING_LEN] = { "open" };
+	size_t tagIndex = 0;
 	for (size_t i = 0; i < RING_LEN; ++i) {
 		struct Entry entry = ring.buf[(ring.end - i) & (RING_LEN - 1)];
 		if (!entry.url || entry.tag != tag.id) continue;
-		if (++count != fromEnd) continue;
-		char *argv[] = { "open", entry.url, NULL };
-		spawn(argv);
-		return;
+		if (tagIndex >= at && tagIndex < to) argv[argc++] = entry.url;
+		tagIndex++;
 	}
+	if (argc > 1) spawn(argv);
 }
e6591159cfe2e0cb442d781c0a360e4928ccca&follow=1'>ui-repolist: HTML-escape cgit_rooturl() responseJohn Keeping 2014-01-12ui-shared: URL-escape script_nameJohn Keeping 2014-01-12ui-refs: escape HTML chars in author and tagger namesJohn Keeping 2014-01-12filter: pass extra arguments via cgit_open_filterJohn Keeping 2014-01-12ui-snapshot: set unused cgit_filter fields to zeroJohn Keeping 2014-01-12html: remove redundant htmlfd variableJohn Keeping 2014-01-12tests: add Valgrind supportJohn Keeping 2014-01-12cache: don't leave cache_slot fields uninitializedJohn Keeping 2014-01-10filter: split filter functions into their own fileJason A. Donenfeld 2014-01-10filter: make exit status localJason A. Donenfeld 2014-01-10parsing: fix header typoJason A. Donenfeld 2014-01-10cgit.c: Fix comment on bit mask hackLukas Fleischer 2014-01-10cgit.c: Use "else" for mutually exclusive branchesLukas Fleischer 2014-01-10ui-snapshot.c: Do not reinvent suffixcmp()Lukas Fleischer 2014-01-10Refactor cgit_parse_snapshots_mask()Lukas Fleischer 2014-01-10Disallow use of undocumented snapshot delimitersLukas Fleischer 2014-01-10Replace most uses of strncmp() with prefixcmp()Lukas Fleischer 2014-01-09README: Fix dependenciesLukas Fleischer 2014-01-08README: Spelling and formatting fixesLukas Fleischer 2014-01-08Fix UTF-8 with syntax-highlighting.pyPřemysl Janouch 2014-01-08Add a suggestion to the manpagePřemysl Janouch 2014-01-08Fix the example configurationPřemysl Janouch 2014-01-08Fix about-formatting.shPřemysl Janouch 2014-01-08Fix some spelling errorsPřemysl Janouch 2014-01-08filters: highlight.sh: add css comments for highlight 2.6 and 3.8Ferry Huberts