-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add terminfo implementation for animating output #25
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
Unfortunately we can't merge this until there's a Windows implementation available. I think I just set up CI infrastructure for Windows, though, so we should at least know! |
Absolutely understand and thanks for setting up the Windows CI build. I'm planning to look into the Windows implementation tonight but don't have a way to test it myself and am not sure how to write tests for these features. Maybe @retep998 or someone else in the Rust Windows community can help. |
I am writing an implementation for Windows right now (and also cleaning up a few bits as well). |
Awesome, thanks! Happy to help or get any critiques. |
Windows implementation of #25
Thanks @retep998! Now that I see what you did, there's no chance I would have figured all that out quickly. And thanks @alexcrichton for the quick merge. This whole contributing as a newbie to Rust thing is pretty fun. Now: is there a process for putting this new version into the |
This is actually somewhat of a fork from the libterm in the main repo, and this is now the "official location" for the library. What's left in the distribution is solely intended for use by the compiler itself. In other words, you're all set! (there's nothing left to do). |
@alexcrichton I believe the intention was to provide this implementation so that it could be used to implement rust-lang/rust#24335. |
Ah in that case a PR would need to be made, yes. We don't have a great story for the duplication of the in-tree libraries with out-of-tree copies in terms of API evolution, although now that we have a sense of stability it may be possible to just submodule everything. @asolove for now feel free to just make a PR against the compiler itself (modifying the in-tree libterm with these changes) and we can sort out the duplication ourselves later :) |
@asolove Don't forget that this library uses |
This proposal adds the terminfo implementations of three commands:
cursor_up
,delete_line
, andcarriage_return
. These three commands provide the building blocks for implementing animated terminal output.I wrote a a sample program that shows how to use these commands to create pretty console progress updates and an animated spinner.
For your consideration:
Attr
enum, because they are commands rather than attributes. I think there is an argument to be made for either renamingAttr
toCommand
or adding these commands into it either way, but wanted to ask someone more knowledgeable for their advice before doing so.carriage_return
is potentially confusing since \r has different behavior on different systems, but the terminfo docs make clear that terminals should implement this command by moving the cursor to the far left of the current line. It should possibly be renamed something likecursor_far_left
.