mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
refact: Inline ProgressBar::draw(state, newOutput), inline local output
This commit is contained in:
parent
047d9643b5
commit
e10ea78f93
1 changed files with 1 additions and 15 deletions
|
@ -379,20 +379,6 @@ public:
|
|||
}
|
||||
|
||||
std::chrono::milliseconds draw(State & state)
|
||||
{
|
||||
std::optional<std::string> newOutput;
|
||||
auto nextWakeup = draw(state, newOutput);
|
||||
if (newOutput)
|
||||
redraw(*newOutput);
|
||||
return nextWakeup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param output[out] `nullopt` if nothing is to be drawn. Otherwise, a
|
||||
* string of ANSI terminal output that can be used to
|
||||
* render the progress bar.
|
||||
*/
|
||||
std::chrono::milliseconds draw(State & state, std::optional<std::string> & output)
|
||||
{
|
||||
auto nextWakeup = std::chrono::milliseconds::max();
|
||||
|
||||
|
@ -445,7 +431,7 @@ public:
|
|||
auto width = getWindowSize().second;
|
||||
if (width <= 0) width = std::numeric_limits<decltype(width)>::max();
|
||||
|
||||
output = "\r" + filterANSIEscapes(line, false, width) + ANSI_NORMAL + "\e[K";
|
||||
redraw("\r" + filterANSIEscapes(line, false, width) + ANSI_NORMAL + "\e[K");
|
||||
|
||||
return nextWakeup;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue