summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build.cc2
-rw-r--r--src/line_printer.cc1
-rw-r--r--src/line_printer.h5
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_;