Skip to content

Handle terminal line wrap to avoid new line#533

Merged
djc merged 3 commits intoconsole-rs:mainfrom
RDruon:wrap_handling
May 9, 2023
Merged

Handle terminal line wrap to avoid new line#533
djc merged 3 commits intoconsole-rs:mainfrom
RDruon:wrap_handling

Conversation

@RDruon
Copy link
Copy Markdown
Contributor

@RDruon RDruon commented Apr 17, 2023

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

Copy link
Copy Markdown
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Would be nice to have some tests for this.

@chris-laplante
Copy link
Copy Markdown
Collaborator

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
Copy link
Copy Markdown
Contributor Author

RDruon commented Apr 24, 2023

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
Copy link
Copy Markdown
Contributor Author

RDruon commented May 9, 2023

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

@djc djc merged commit 3d5dbb3 into console-rs:main May 9, 2023
@djc
Copy link
Copy Markdown
Member

djc commented May 9, 2023

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

@chris-laplante
Copy link
Copy Markdown
Collaborator

Sorry for the delay! Looks good to me as well

@djc djc mentioned this pull request May 24, 2023
lgarron added a commit to lgarron/folderify that referenced this pull request Jun 2, 2023
Release notes:

- Avoid extra newlines in narrow terminals by bumping the `indicatif` dependency to v0.17.4.
  - This pulls in the fix for console-rs/indicatif#533
  - console-rs/indicatif#520 is still an issue if the terminal only has space for ≈lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants