console-rs / indicatif

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

Handle terminal line wrap to avoid new line #533

Closed RDruon closed 1 year ago

RDruon commented 1 year ago

Terminal usually wrap line in case it can't fit the current terminal width. This behavior is not taken in account by indicatif and create some visual artifacts.

The issue was reported as #144 (closed with a workaround) and #520.

Please find below a demo without the patch: WindowsTerminal_wwpvPvmRKY

Demo with the patch: WindowsTerminal_Q7z1mdXh3O

Using #144 example: WindowsTerminal_HVhbcstdMB

chris-laplante commented 1 year ago

Seems like a nice improvement to me! @chris-laplante what do you think?

Would be nice to have some tests for this.

Makes sense to me too! I agree some tests would be nice. @RDruon are you able to implement a render test or two for this?

RDruon commented 1 year ago

Seems like a nice improvement to me! @chris-laplante what do you think? Would be nice to have some tests for this.

Makes sense to me too! I agree some tests would be nice. @RDruon are you able to implement a render test or two for this?

I added 2 render tests, one with ProgressBar and one with MultiProgress

RDruon commented 1 year ago

@chris-laplante could I get another review? It seems several projects are interested in this change.

djc commented 1 year ago

I think this is looking good, thanks! @chris-laplante feel free to follow-up if you have more thoughts.

chris-laplante commented 1 year ago

Sorry for the delay! Looks good to me as well