summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2014-12-02 06:21:54 (GMT)
committerNico Weber <thakis@chromium.org>2014-12-02 06:21:54 (GMT)
commitf2a905b9350fa07e7ec91ab3d43a362938637205 (patch)
tree454548f50011d4b28765c630a58c09abd63f4ad3 /src
parent2786f6f8de711251646daca957dbd02d2a95833e (diff)
downloadNinja-f2a905b9350fa07e7ec91ab3d43a362938637205.zip
Ninja-f2a905b9350fa07e7ec91ab3d43a362938637205.tar.gz
Ninja-f2a905b9350fa07e7ec91ab3d43a362938637205.tar.bz2
win: Use full console width for status messages.
The original overprinting code, added in 7b3d8c8e, used printf for printing the status. printf needs one column for the cursor, so the status message could only take up `width - 1` columns. fc554c22 changed Windows from printf to WriteConsoleOutput which doesn't move the cursor, so keeping one column empty is no longer needed. So stop doing that. Also remove a duplicate call to GetConsoleScreenBufferInfo.
Diffstat (limited to 'src')
-rw-r--r--src/line_printer.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/line_printer.cc b/src/line_printer.cc
index e11bcc3..2cd3e17 100644
--- a/src/line_printer.cc
+++ b/src/line_printer.cc
@@ -61,13 +61,10 @@ void LinePrinter::Print(string to_print, LineType type) {
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(console_, &csbi);
- // Don't use the full width or console will move to next line.
- size_t width = static_cast<size_t>(csbi.dwSize.X) - 1;
- to_print = ElideMiddle(to_print, width);
- // We don't want to have the cursor spamming back and forth, so
- // use WriteConsoleOutput instead which updates the contents of
- // the buffer, but doesn't move the cursor position.
- GetConsoleScreenBufferInfo(console_, &csbi);
+ to_print = ElideMiddle(to_print, static_cast<size_t>(csbi.dwSize.X));
+ // We don't want to have the cursor spamming back and forth, so instead of
+ // printf use WriteConsoleOutput which updates the contents of the buffer,
+ // but doesn't move the cursor position.
COORD buf_size = { csbi.dwSize.X, 1 };
COORD zero_zero = { 0, 0 };
SMALL_RECT target = {