Skip to content

Use ellipses when truncating progress #15330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WhyNotHugo
Copy link

@WhyNotHugo WhyNotHugo commented Mar 19, 2025

What does this PR try to resolve?

Visual quirkiness in progress that doesn't fit on screen. Instead of using three periods at the end of the screen, use an ellipses.

How should we test and review this PR?

Any regular operation on a narrow screen should make the difference evident.

Additional information

n/a

Use ellipses when truncating progress instead of three periods. While
this allows an extra two characters to fit on screen, the main
motivation it to reduce the visual quirkiness or the resulting output.
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2025

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-console-output Area: Terminal output, colors, progress bar, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2025
ellipsis_pos = string.len();
}
} else {
string.truncate(ellipsis_pos);
string.push_str("...");
string.push_str("");
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not unconditionally output unicode characters but need to check either shell().out_unicode() or shell().err_unicode().

Copy link
Author

Choose a reason for hiding this comment

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

Unicode is a superset of ascii. I assume you mean non-ascii Unicode?

It actually slipped my mind that this is non-ascii. I'll update this and review the tests below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unicode is a superset of ascii. I assume you mean non-ascii Unicode?

Yes

@epage
Copy link
Contributor

epage commented Mar 19, 2025

Thanks for contributing this! It would be great to find ways to better leverage unicode output now that we can with term.unicode being added in #13337.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants