diff --git a/src/ConsoleStatCalc.cc b/src/ConsoleStatCalc.cc index 601da994..c8969f16 100644 --- a/src/ConsoleStatCalc.cc +++ b/src/ConsoleStatCalc.cc @@ -230,7 +230,8 @@ void printProgressSummary ConsoleStatCalc::ConsoleStatCalc(time_t summaryInterval, bool humanReadable): summaryInterval_(summaryInterval), - readoutVisibility_(true) + readoutVisibility_(true), + truncate_(true) { if(humanReadable) { sizeFormatter_.reset(new AbbrevSizeFormatter()); @@ -362,7 +363,7 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e) std::string readout = o.str(); if(isTTY) { std::string::iterator last = readout.begin(); - if(readout.size() > cols) { + if(truncate_ && readout.size() > cols) { std::advance(last, cols); } else { last = readout.end(); diff --git a/src/ConsoleStatCalc.h b/src/ConsoleStatCalc.h index 2ee99e7f..566f7aa8 100644 --- a/src/ConsoleStatCalc.h +++ b/src/ConsoleStatCalc.h @@ -64,6 +64,7 @@ private: SharedHandle sizeFormatter_; bool readoutVisibility_; + bool truncate_; public: ConsoleStatCalc(time_t summaryInterval, bool humanReadable = true); @@ -75,6 +76,11 @@ public: { readoutVisibility_ = visibility; } + + void setTruncate(bool truncate) + { + truncate_ = truncate; + } }; typedef SharedHandle ConsoleStatCalcHandle; diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 4af3cdf6..c5bde6f2 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -587,6 +587,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_ADVANCED); handlers.push_back(op); } + { + SharedHandle op(new BooleanOptionHandler + (PREF_TRUNCATE_CONSOLE_READOUT, + TEXT_TRUNCATE_CONSOLE_READOUT, + A2_V_TRUE, + OptionHandler::OPT_ARG)); + op->addTag(TAG_ADVANCED); + handlers.push_back(op); + } { SharedHandle op(new BooleanOptionHandler (PREF_RPC_LISTEN_ALL, diff --git a/src/main.cc b/src/main.cc index ce0657df..57100342 100644 --- a/src/main.cc +++ b/src/main.cc @@ -98,6 +98,7 @@ SharedHandle getStatCalc(const SharedHandle