diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2018-11-05 15:48:31 (GMT) |
---|---|---|
committer | Jan Niklas Hasse <jhasse@bixense.com> | 2018-11-05 15:49:39 (GMT) |
commit | 10e66a153daa7b8ce664948031136ba27e8dfeba (patch) | |
tree | ec5e6f63a7f772f798d400a4d3624591a85625e7 /src | |
parent | 0eb7199902ce1566a39caa8f782c417a59095b6a (diff) | |
download | Ninja-10e66a153daa7b8ce664948031136ba27e8dfeba.zip Ninja-10e66a153daa7b8ce664948031136ba27e8dfeba.tar.gz Ninja-10e66a153daa7b8ce664948031136ba27e8dfeba.tar.bz2 |
Do not always strip colored output in verbose mode, fix #1214
Diffstat (limited to 'src')
-rw-r--r-- | src/build.cc | 2 | ||||
-rw-r--r-- | src/line_printer.cc | 1 | ||||
-rw-r--r-- | src/line_printer.h | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/build.cc b/src/build.cc index c24d6a9..9852a50 100644 --- a/src/build.cc +++ b/src/build.cc @@ -169,7 +169,7 @@ void BuildStatus::BuildEdgeFinished(Edge* edge, // thousands of parallel compile commands.) // TODO: There should be a flag to disable escape code stripping. string final_output; - if (!printer_.is_smart_terminal()) + if (!printer_.supports_color()) final_output = StripAnsiEscapeCodes(output); else final_output = output; diff --git a/src/line_printer.cc b/src/line_printer.cc index 2cd3e17..cfc1f19 100644 --- a/src/line_printer.cc +++ b/src/line_printer.cc @@ -41,6 +41,7 @@ LinePrinter::LinePrinter() : have_blank_line_(true), console_locked_(false) { CONSOLE_SCREEN_BUFFER_INFO csbi; smart_terminal_ = GetConsoleScreenBufferInfo(console_, &csbi); #endif + supports_color_ = smart_terminal_; } void LinePrinter::Print(string to_print, LineType type) { diff --git a/src/line_printer.h b/src/line_printer.h index 55225e5..92d4dc4 100644 --- a/src/line_printer.h +++ b/src/line_printer.h @@ -27,6 +27,8 @@ struct LinePrinter { bool is_smart_terminal() const { return smart_terminal_; } void set_smart_terminal(bool smart) { smart_terminal_ = smart; } + bool supports_color() const { return supports_color_; } + enum LineType { FULL, ELIDE @@ -46,6 +48,9 @@ struct LinePrinter { /// Whether we can do fancy terminal control codes. bool smart_terminal_; + /// Whether we can use ISO 6429 (ANSI) color sequences. + bool supports_color_; + /// Whether the caret is at the beginning of a blank line. bool have_blank_line_; |