]> git.lizzy.rs Git - bspwm.git/commitdiff
Discard colons within references
authorBastien Dejean <nihilhill@gmail.com>
Sun, 1 Nov 2020 20:07:47 +0000 (21:07 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Sun, 1 Nov 2020 20:07:47 +0000 (21:07 +0100)
Fixes #1218.

src/query.c

index 9e0cc63bedba0440c234df93d53b4832bc7636c5..ccfc146c0620f69f69859ca29b3a95f28f40254b 100644 (file)
@@ -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)) {