mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Minor bug fixes and updates:
* Removed progress bar sample that progresses in reverse direction - This needs a class of its own * Fixed a casting error in progress_bar class when dealing with max_progress variable * Minor update to the cursor movement functions in linux * Updated single include to include these changes
This commit is contained in:
@@ -158,38 +158,6 @@ int main() {
|
||||
thread4.join();
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
{
|
||||
//
|
||||
// GOING BACKWARDS
|
||||
//
|
||||
indicators::ProgressBar p{option::BarWidth{50},
|
||||
option::Start{"["},
|
||||
option::Fill{"■"},
|
||||
option::Lead{"■"},
|
||||
option::Remainder{"-"},
|
||||
option::End{"]"},
|
||||
option::ForegroundColor{indicators::Color::white},
|
||||
option::PostfixText{"Reverting system restore"},
|
||||
option::FontStyles{
|
||||
std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}};
|
||||
p.set_progress(100); // TODO backwards as an option?
|
||||
std::atomic<size_t> progress{100};
|
||||
auto job = [&p, &progress]() {
|
||||
while (true) {
|
||||
progress -= 1;
|
||||
p.set_progress(progress);
|
||||
if (progress == 0) {
|
||||
p.set_option(option::PostfixText{"Revert complete!"});
|
||||
p.mark_as_completed();
|
||||
break;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(60));
|
||||
}
|
||||
};
|
||||
std::thread thread(job);
|
||||
thread.join();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user