From 01107f974b94ad00e5f8403492602060ae90189e Mon Sep 17 00:00:00 2001 From: Bastien Dejean Date: Sun, 1 Nov 2020 21:07:47 +0100 Subject: [PATCH] Discard colons within references Fixes #1218. --- src/query.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/query.c b/src/query.c index 9e0cc63..ccfc146 100644 --- a/src/query.c +++ b/src/query.c @@ -542,7 +542,7 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) char *path = strrchr(desc, '@'); char *colon = strrchr(desc, ':'); - /* Discard hashes inside a DESKTOP_SEL */ + /* Discard hashes inside a DESKTOP_SEL, e.g. `newest#@prev#older:/1/2` */ if (hash != NULL && colon != NULL && path != NULL && path < hash && hash < colon) { if (path > desc && *(path - 1) == '#') { @@ -564,6 +564,11 @@ int node_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst) } } + /* Discard colons within references, e.g. `@next.occupied:/#any.descendant_of.window` */ + if (colon != NULL && hash != NULL && colon < hash) { + colon = NULL; + } + node_select_t sel = make_node_select(); if (!parse_node_modifiers(colon != NULL ? colon : desc, &sel)) { -- 2.44.0