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 'url.c')
-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);
 }
ass='logsubject'>Add -a flag to xxJune McEnroe 2016-09-12Add -o flag to xxJune McEnroe 2016-09-12Add -g option to xxJune McEnroe 2016-09-12Add -c option to xxJune McEnroe 2016-09-12Add .bin/xx.cJune McEnroe 2016-09-08Rename colorscheme to lameJune McEnroe 2016-09-04Simplify colors syntax in zsh promptJune McEnroe 2016-08-29Color rubyStringDelimiter as StringJune McEnroe 2016-08-24Highlight rubyDefine as StructureJune McEnroe 2016-08-23Remove scroll bindings from nvim configJune McEnroe 2016-08-17Highlight Search with black foregroundJune McEnroe 2016-08-15Remove gruvboxJune McEnroe 2016-08-04Remove march from SSH configJune McEnroe 2016-08-01Disable tab indicators in iTermJune McEnroe 2016-07-30Color PreProc DarkGreenJune McEnroe 2016-07-29Color Structure and Typedef in grayJune McEnroe 2016-07-27Color comments DarkBlue and LightBlueJune McEnroe 2016-07-27Color macros in yellowJune McEnroe 2016-07-26Colorscheme colors and schemesJune McEnroe 2016-07-26Add ''subtle'' colorschemeJune McEnroe I'm just trying this out. 2016-07-26Add htoprcJune McEnroe 2016-07-24Add may and refactor ssh configJune McEnroe 2016-07-18Disable cursorlineJune McEnroe 2016-07-18Use hard constrast gruvbox darkJune McEnroe 2016-07-15Remove vim configurationJune McEnroe 2016-07-15Add readline to README configurations listJune McEnroe 2016-07-15Add vendor script to READMEJune McEnroe 2016-07-15Pull latest pathogen and gruvboxJune McEnroe