Skip to content

Commit

Permalink
Discard colons within references
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed Nov 1, 2020
1 parent ddb2d32 commit 01107f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) == '#') {
Expand All @@ -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)) {
Expand Down

0 comments on commit 01107f9

Please sign in to comment.