console-rs / indicatif

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

Fix 612 #613

Closed smoelius closed 6 months ago

smoelius commented 6 months ago

Fixes #612

Note that I have to eat my words. This PR does not use the approach that @djc suggested:

I don't have a strong preference so open to arguments that I'm wrong, but I feel like a "line" being a horizontal stripe across the window (that is, counting multiple for wrapped lines) is probably the more intuitive concept?

I tried to do that, but I ran into trouble here: https://github.com/console-rs/indicatif/blob/8941d5e8f55fe32a629a80872ee20971c00ee53d/src/draw_target.rs#L390

That is, DrawStateWrapper's drop handler uses state.orphan_lines_count as a number of state.lines entries, and I couldn't see a good way around that. So I adapted the other parts of the code to use the same approach.

This PR currently has five commits. I think they should make sense indiviudally.