From e710477a07d99aed04694d7a50a280c1766f47a0 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 25 Oct 2011 22:31:57 +0100 Subject: [PATCH] Bugfix: properly handle comments in colors {} blocks of bar config (+test) (Thanks fernandotcl) --- src/cfgparse.l | 1 + testcases/t/177-bar-config.t | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) 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; -- 2.39.5