summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-10-31 10:15:59 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-10-31 10:15:59 +0000
commit0dcb41da49c41f0f76bb538b93796a4d0dda2146 (patch)
tree4f0c9df40de222ae587ab44564bcaabb6c006fb9
parent07dc5bdfee991bed813ae59457855c312c38da32 (diff)
2009-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that in Windows environment new blank line is inserted when console readout is updated. * src/ConsoleStatCalc.cc
-rw-r--r--ChangeLog6
-rw-r--r--src/ConsoleStatCalc.cc8
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index e298137a..0a63c206 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+ Fixed the bug that in Windows environment new blank line is
+ inserted when console readout is updated.
+ * src/ConsoleStatCalc.cc
+
+2009-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+
Throw exception if binding listening port is failed. Removed
RequestGroupMan::getInitialCommand(). Use
fillRequestGroupFromReserver() instead. Delete commands for
diff --git a/src/ConsoleStatCalc.cc b/src/ConsoleStatCalc.cc
index fca59adc..ff60b0cc 100644
--- a/src/ConsoleStatCalc.cc
+++ b/src/ConsoleStatCalc.cc
@@ -207,11 +207,19 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e)
bool isTTY = isatty(STDOUT_FILENO) == 1;
unsigned short int cols = 80;
+#ifdef __MINGW32__
+ // Windows terminal cannot handle at the end of line properly.
+ --cols;
+#endif // __MINGW32__
if(isTTY) {
#ifdef HAVE_TERMIOS_H
struct winsize size;
if(ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == 0) {
cols = size.ws_col;
+#ifdef __MINGW32__
+ // Windows terminal cannot handle at the end of line properly.
+ --cols;
+#endif // __MINGW32__
}
#endif // HAVE_TERMIOS_H
std::cout << '\r' << std::setfill(' ') << std::setw(cols) << ' ' << '\r';