From b3e1fb1f3b04290bceaa3ab7915b7d1119be93ac Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 11 Sep 2011 21:16:45 +0100 Subject: [PATCH] Make the old 'assign' case-insensitive again (+test) (Thanks aksr) --- src/cfgparse.y | 16 ++++++++++++++-- testcases/t/66-assign.t | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/cfgparse.y b/src/cfgparse.y index 868640e0..7efecc92 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -1071,11 +1071,23 @@ assign: char *separator = NULL; if ((separator = strchr(criteria, '/')) != NULL) { *(separator++) = '\0'; - match->title = regex_new(separator); + char *pattern; + if (asprintf(&pattern, "(?i)%s", separator) == -1) { + ELOG("asprintf failed\n"); + break; + } + match->title = regex_new(pattern); + free(pattern); printf(" title = %s\n", separator); } if (*criteria != '\0') { - match->class = regex_new(criteria); + char *pattern; + if (asprintf(&pattern, "(?i)%s", criteria) == -1) { + ELOG("asprintf failed\n"); + break; + } + match->class = regex_new(pattern); + free(pattern); printf(" class = %s\n", criteria); } free(criteria); diff --git a/testcases/t/66-assign.t b/testcases/t/66-assign.t index 776710e7..25855b58 100644 --- a/testcases/t/66-assign.t +++ b/testcases/t/66-assign.t @@ -182,6 +182,46 @@ exit_gracefully($process->pid); sleep 0.25; +##################################################################### +# make sure that assignments are case-insensitive in the old syntax. +##################################################################### + +$config = <root->create_child( + class => WINDOW_CLASS_INPUT_OUTPUT, + rect => [ 0, 0, 30, 30 ], + background_color => '#0000ff', +); + +$window->_create; +set_wm_class($window->id, 'SPEcial', 'SPEcial'); +$window->name('special window'); +$window->map; +sleep 0.25; + +my $content = get_ws($tmp); +ok(@{$content->{nodes}} == 0, 'no tiling cons'); +ok(@{$content->{floating_nodes}} == 1, 'one floating con'); + +$window->destroy; + +exit_gracefully($process->pid); + +sleep 0.25; + ##################################################################### # regression test: dock clients with floating assignments should not crash # (instead, nothing should happen - dock clients can’t float) -- 2.39.5