From a73eaaabd9b85a483311df0e286f286cc99d9f96 Mon Sep 17 00:00:00 2001 From: Herman Venter Date: Mon, 3 Jun 2013 19:58:51 -0700 Subject: [PATCH] Do not persist the EnableDebuggerColor config option into the hphpd.hdf file The ~/hphpd.hdf file provides the ability to customize (or turn off) colorization in hphpd as a user preference. The EnableDebuggerColor option turns of colorization for a single run only and should not persist into hphpd.hdf. --- hphp/runtime/debugger/debugger_client.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hphp/runtime/debugger/debugger_client.cpp b/hphp/runtime/debugger/debugger_client.cpp index 03d2d0b95..3732b821e 100644 --- a/hphp/runtime/debugger/debugger_client.cpp +++ b/hphp/runtime/debugger/debugger_client.cpp @@ -621,19 +621,18 @@ void DebuggerClient::init(const DebuggerClientOptions &options) { loadConfig(); if (!options.cmds.empty()) { - UseColor = false; + RuntimeOption::EnableDebuggerColor = false; s_use_utf8 = false; NoPrompt = true; } if (options.apiMode) { - UseColor = false; + RuntimeOption::EnableDebuggerColor = false; NoPrompt = true; m_outputBuf.clear(); } - UseColor &= RuntimeOption::EnableDebuggerColor; - if (UseColor) Debugger::SetTextColors(); + if (UseColor && RuntimeOption::EnableDebuggerColor) Debugger::SetTextColors(); if (!NoPrompt) { info("Welcome to HipHop Debugger!"); @@ -1283,7 +1282,8 @@ bool DebuggerClient::code(CStrRef source, int line1 /*= 0*/, int line2 /*= 0*/, } } if (!sb.empty()) { - print("%s%s", sb.data(), !UseColor ? "\0" : ANSI_COLOR_END); + print("%s%s", sb.data(), + UseColor && RuntimeOption::EnableDebuggerColor ? ANSI_COLOR_END : "\0"); return true; } return false; @@ -1296,7 +1296,7 @@ char DebuggerClient::ask(const char *fmt, ...) { va_list ap; va_start(ap, fmt); Util::string_vsnprintf(msg, fmt, ap); va_end(ap); - if (UseColor && InfoColor) { + if (UseColor && InfoColor && RuntimeOption::EnableDebuggerColor) { msg = InfoColor + msg + ANSI_COLOR_END; } fwrite(msg.data(), 1, msg.length(), stdout); @@ -1345,7 +1345,7 @@ void DebuggerClient::print(CStrRef msg) { #define IMPLEMENT_COLOR_OUTPUT(name, where, color) \ void DebuggerClient::name(CStrRef msg) { \ - if (UseColor && color) { \ + if (UseColor && color && RuntimeOption::EnableDebuggerColor) { \ FWRITE(color, 1, strlen(color), where); \ } \ FWRITE(msg.data(), 1, msg.length(), where); \ @@ -2300,9 +2300,9 @@ void DebuggerClient::loadConfig() { m_config["UTF8"] = s_use_utf8; // for starter Hdf color = m_config["Color"]; - UseColor = color.getBool(true) && RuntimeOption::EnableDebuggerColor; + UseColor = color.getBool(true); color = UseColor; // for starter - if (UseColor) { + if (UseColor && RuntimeOption::EnableDebuggerColor) { defineColors(); // (1) no one can overwrite, (2) for starter LoadColors(color); }