Do not count undo operations in the 'would be reverted..' message (#3598)

This commit is contained in:
Dustin J. Mitchell 2024-08-14 08:35:34 -04:00 committed by GitHub
parent d46e5eca58
commit 70632b088e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -242,7 +242,16 @@ void TDB2::revert() {
bool TDB2::confirm_revert(rust::Vec<tc::Operation>& undo_ops) {
// TODO Use show_diff rather than this basic listing of operations, though
// this might be a worthy undo.style itself.
std::cout << "The following " << undo_ops.size() << " operations would be reverted:\n";
// Count non-undo operations
int ops_count = 0;
for (auto& op : undo_ops) {
if (!op.is_undo_point()) {
ops_count++;
}
}
std::cout << "The following " << ops_count << " operations would be reverted:\n";
for (auto& op : undo_ops) {
if (op.is_undo_point()) {
continue;