Skip to content
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

Emit progress state escape codes #11436

Closed

Conversation

albertlarsan68
Copy link
Member

Emit progress state escape codes when drawing progress bar.

Fixes #11432

@rustbot
Copy link
Collaborator

rustbot commented Nov 28, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 28, 2022
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request, and sorry for the long wait.

This is a UI change. Could you demonstrate demo GIFs or videos for it? It would be helpful if you could provide the result on both msvc and mingw.

In addition, do you have the official documentation at hand about this escape code? CodeEmu doc doesn't seem to be official I feel like.

src/cargo/util/progress.rs Outdated Show resolved Hide resolved
@@ -39,6 +40,25 @@ struct Format {
max_print: usize,
}

enum ProgressCode {
Copy link
Member

Choose a reason for hiding this comment

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

This is Windows-only feature, right? Is it possible to add #[cfg(windows)] for all relevant code and items?

Also, having doc comments on each new items would be fantastic. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I do think that other terminal emulators may also implement those, but I can't verify now.
It seems like per alacritty/alacritty#5201, it won't get this support, however.

@albertlarsan68
Copy link
Member Author

In addition, do you have the official documentation at hand about this escape code? CodeEmu doc doesn't seem to be official I feel like.

As per microsoft/terminal#8055, the ConEmu style is the implementation reference.

@albertlarsan68
Copy link
Member Author

albertlarsan68 commented Dec 21, 2022

Here is a screen recording of running cargo check with b60dc0d (I recommend watching it at x2 speed):

2022-12-21.14-57-40.mp4

Notice the bar in the taskbar, and the circle getting bigger / fuller at the top left corner.

@weihanglo
Copy link
Member

Thanks for the screen recording!

Unfortunately on macOS it doesn't seem to compile: https://github.com/rust-lang/cargo/actions/runs/3749845063/jobs/6368801382

I am still uncertain the adoption rate of this non-standard escape code. Does the majority of terminal emulators handle or ignore this well? Sorry being so conservative but I've seen some issue around “escape code not recognized” sometimes. That's also why I suggested adding #[cfg(windows)] at the very first, and even on Windows there are a bunch of different emulators. I'd recommend collecting the usage and support data before rolling out this feature :)

@albertlarsan68
Copy link
Member Author

albertlarsan68 commented Dec 21, 2022

Current testing progress:

Terminal Support
Windows Terminal
Git MinTTY ✅ (but reset only happens when progress is set to 0)
Alacritty ❌ (Feature seemingly refused)

Procedure:
run echo -e "\e]9;4;1;50\e\\" for Linux-like, or copy the line below for Powershell Core and paste it at the prompt.
Reset with echo -e "\e]9;4;0;50\e\\" or the second line. If that doesn't work replace the 50 with a 0.

"`e]9;4;1;50`e\"
"`e]9;4;0;50`e\"

@weihanglo weihanglo added S-blocked and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2023
@weihanglo
Copy link
Member

#11436 (comment) was a good try. Thank you. I'll probably split Support to two columns:

  • Support the display of the progress bar or not.
  • If not supported, would it break things or just ignore the unrecognized escape code?

Marked this as S-blocked as it need more data to ensure it won't break the majority from different terminal on Windows.

@weihanglo weihanglo added S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. and removed S-blocked labels Apr 18, 2023
@weihanglo weihanglo marked this pull request as draft April 18, 2023 21:55
@weihanglo
Copy link
Member

weihanglo commented May 11, 2023

Personally I love this kind of good UI enhancement with the system. We just need more data to make sure it is safe for most people. Going to close due to inactivity. We still look for people investing in surveying.

Thank you anyway!

Edited: track in #11432.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use ANSI codes to report progress
4 participants