console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.22k stars 238 forks source link

Fix attempt to subtract with overflow (#582) #586

Closed smoelius closed 9 months ago

smoelius commented 10 months ago

Fixes #582

The test orphan_lines reproduces the panic. The test orphan_lines_message_above_progress_bar tries to ensure that messages are still printed correctly following the fix.

The proposed fix is to effectively ignore self.orphan_lines_count many lines from real_len when comparing real_len to the terminal height.

@oli-obk Would you be able to glance at this? :pray:

smoelius commented 9 months ago

Sorry, I failed to fix a comment.

To whomever keeps approving the workflows: thank you. :pray:

chris-laplante commented 9 months ago

To whomever keeps approving the workflows: thank you. 🙏

We gotchu :)

djc commented 9 months ago

@chris-laplante do you want to do a final review before (squash and) merge?

@smoelius thanks for your work in getting this right, and @oli-obk thanks for the reviews!