-
Notifications
You must be signed in to change notification settings - Fork 29
Add support for pagination in the CLI wallet #1894
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
Conversation
header: String, | ||
body: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO "paginate" should accept a more structured data, where "header" is a list of column names and "body" is a table.
A TODO would be fine too for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added TODO
crossterm::terminal::enable_raw_mode().expect("Should not fail normally"); | ||
let event = crossterm::event::read().expect("Should not fail normally"); | ||
crossterm::terminal::disable_raw_mode().expect("Should not fail normally"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Probably the more correct way is to switch to the raw mode once at the beginning and switch back via
OnceDestructor
.
(and probably we should first check that the terminal is not in the raw mode already).The problem is that
println!
(and thereforeConsoleOutput::print_line
) won't work properly, because "\n" won't return the cursor to the beginning of the line ("\r" is needed for that).
But we can just add a separate functionConsoleOutput::print
(so that the line separator can be chosen by the caller) and mention in comments that the existingprint_line
andprint_error
are not suitable for a terminal in a raw mode.(though I'm not sure if the current implementation has any drawbacks, besides not looking nice).
-
We probably need a way of pausing logging while in the pagination mode, because when the loop is waiting for a key press, the terminal is in the raw mode either way. So if a logging event happens, it won't be printed correctly (due to "\n" not returning the cursor).
Let's maybe at least add some TODOs for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added OnceDestructor for the inner loop, and added TODO for the outer loop
9d4a512
to
b4c0c50
Compare
b4c0c50
to
6184588
Compare
No description provided.