From: Michael Stapelberg Date: Tue, 25 Oct 2011 21:31:57 +0000 (+0100) Subject: Bugfix: properly handle comments in colors {} blocks of bar config (+test) (Thanks... X-Git-Tag: 4.1~45 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=e710477a07d99aed04694d7a50a280c1766f47a0 Bugfix: properly handle comments in colors {} blocks of bar config (+test) (Thanks fernandotcl) --- diff --git a/src/cfgparse.l b/src/cfgparse.l index 2bab9d6a..1f584c32 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -106,6 +106,7 @@ EOL (\r?\n) colors { yy_push_state(BAR_COLORS); return TOK_BAR_COLORS; } "{" { return '{'; } "}" { yy_pop_state(); return '}'; } +^[ \t]*#[^\n]* { return TOKCOMMENT; } background { yy_push_state(BAR_COLOR); return TOK_BAR_COLOR_BACKGROUND; } statusline { yy_push_state(BAR_COLOR); return TOK_BAR_COLOR_STATUSLINE; } focused_workspace { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_FOCUSED_WORKSPACE; } diff --git a/testcases/t/177-bar-config.t b/testcases/t/177-bar-config.t index 72067316..0bf287b7 100644 --- a/testcases/t/177-bar-config.t +++ b/testcases/t/177-bar-config.t @@ -170,4 +170,39 @@ isnt($bar1_config->{outputs}, $bar2_config->{outputs}, 'outputs different'); exit_gracefully($pid); +##################################################################### +# make sure comments work properly +##################################################################### + +$config = <get_bar_config()->recv; +$bar_id = shift @$bars; + +$bar_config = $i3->get_bar_config($bar_id)->recv; +is($bar_config->{status_command}, 'i3status --bar', 'status_command correct'); +is($bar_config->{colors}->{background}, '#000000', 'background color ok'); + +exit_gracefully($pid); + done_testing;