From 60452d9745ec356e247fedc468847954686934d2 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 31 Mar 2014 20:07:02 +0100 Subject: [PATCH] echo command accepts -debug switch to write to the debug buffer --- src/commands.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 48e549bc..a77c8dbb 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -677,7 +677,8 @@ const CommandDesc echo_cmd = { nullptr, "echo ...: display given parameters in the status line", ParameterDesc{ - SwitchMap{ { "color", { true, "set message color" } } }, + SwitchMap{ { "color", { true, "set message color" } }, + { "debug", { false, "write to debug buffer instead of status line" } } }, ParameterDesc::Flags::SwitchesOnlyAtStart }, CommandFlags::None, @@ -687,9 +688,14 @@ const CommandDesc echo_cmd = { String message; for (auto& param : parser) message += param + " "; - ColorPair color = get_color(parser.has_option("color") ? - parser.option_value("color") : "StatusLine"); - context.print_status({ std::move(message), color } ); + if (parser.has_option("debug")) + write_debug(message); + else + { + auto color = get_color(parser.has_option("color") ? + parser.option_value("color") : "StatusLine"); + context.print_status({ std::move(message), color } ); + } } };