diff options
author | June McEnroe <june@causal.agency> | 2020-07-11 14:37:12 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-11 14:37:12 -0400 |
commit | 35cd2a86ed8ec3c053d10152799725dbba2ff44b (patch) | |
tree | d2311568f730aaf5e4ff9869ec1268d57bfb1023 | |
parent | Bump database version (diff) | |
download | scooper-35cd2a86ed8ec3c053d10152799725dbba2ff44b.tar.gz scooper-35cd2a86ed8ec3c053d10152799725dbba2ff44b.zip |
Preserve search query when clicking network or context columns
Diffstat (limited to '')
-rw-r--r-- | html.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/html.c b/html.c index 562f909..49b65e9 100644 --- a/html.c +++ b/html.c @@ -203,11 +203,13 @@ static enum kcgi_err eventTime(struct khtmlreq *html, struct Event event) { return error; } -static enum kcgi_err eventNetwork(struct khtmlreq *html, struct Event event) { - if (!event.network) return KCGI_OK; +static enum kcgi_err +eventNetwork(struct khtmlreq *html, struct Scope scope, struct Event event) { + if (scope.network || !scope.query || !event.network) return KCGI_OK; char *href = khttp_urlpart( - NULL, NULL, Pages[Contexts], + NULL, NULL, Pages[Search], Keys[Network].name, event.network, + Keys[Query].name, scope.query, NULL ); if (!href) err(EX_OSERR, "khttp_urlpart"); @@ -220,12 +222,16 @@ static enum kcgi_err eventNetwork(struct khtmlreq *html, struct Event event) { return error; } -static enum kcgi_err eventContext(struct khtmlreq *html, struct Event event) { - if (!event.network || !event.context) return KCGI_OK; +static enum kcgi_err +eventContext(struct khtmlreq *html, struct Scope scope, struct Event event) { + if (scope.context || !scope.query || !event.network || !event.context) { + return KCGI_OK; + } char *href = khttp_urlpart( - NULL, NULL, Pages[Events], + NULL, NULL, Pages[Search], Keys[Network].name, event.network, Keys[Context].name, event.context, + Keys[Query].name, scope.query, NULL ); if (!href) err(EX_OSERR, "khttp_urlpart"); @@ -297,8 +303,8 @@ htmlEvent(struct khtmlreq *html, struct Scope scope, struct Event event) { KATTR__MAX ) || eventTime(html, event) - || (scope.network ? 0 : eventNetwork(html, event)) - || (scope.context ? 0 : eventContext(html, event)) + || eventNetwork(html, scope, event) + || eventContext(html, scope, event) || eventNick(html, event) || eventMessage(html, event) || khtml_closeelem(html, 1); |