From: Michael Stapelberg Date: Sun, 11 Sep 2011 20:16:45 +0000 (+0100) Subject: Make the old 'assign' case-insensitive again (+test) (Thanks aksr) X-Git-Tag: 4.1~166^2~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b3e1fb1f3b04290bceaa3ab7915b7d1119be93ac;p=i3%2Fi3 Make the old 'assign' case-insensitive again (+test) (Thanks aksr) --- 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)