-
Notifications
You must be signed in to change notification settings - Fork 63
[wicket] add page up/page down/home/end to the keymap #3692
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
[wicket] add page up/page down/home/end to the keymap #3692
Conversation
Created using spr 1.3.4
| /// Returns the effective, or actual, scroll kind after the text is laid | ||
| /// out. | ||
| /// | ||
| /// If this is a `PopupScrollKind::Enabled` popup, the offset is is capped | ||
| /// to the maximum degree to which text can be scrolled. | ||
| pub fn actual_scroll_kind(&self) -> PopupScrollKind { | ||
| self.actual_scroll_kind | ||
| } | ||
| /// Returns the maximum width that this popup can have, including outer | ||
| /// borders. | ||
| /// | ||
| /// This is currently 80% of screen width. | ||
| pub fn popup_max_width(full_screen_width: u16) -> u16 { | ||
| (full_screen_width as u32 * 4 / 5) as u16 | ||
| } | ||
|
|
||
| /// Returns the maximum width that this popup can have, including outer | ||
| /// borders. | ||
| /// | ||
| /// This is currently 80% of screen width. | ||
| pub fn max_width(full_screen_width: u16) -> u16 { | ||
| (full_screen_width as u32 * 4 / 5) as u16 | ||
| } | ||
| /// Returns the maximum width that this popup can have, not including outer | ||
| /// borders. | ||
| pub fn popup_max_content_width(full_screen_width: u16) -> u16 { | ||
| // -2 for borders, -2 for padding | ||
| popup_max_width(full_screen_width).saturating_sub(4) | ||
| } | ||
|
|
||
| /// Returns the maximum width that this popup can have, not including outer | ||
| /// borders. | ||
| pub fn max_content_width(full_screen_width: u16) -> u16 { | ||
| // -2 for borders, -2 for padding | ||
| Self::max_width(full_screen_width).saturating_sub(4) | ||
| } | ||
| /// Returns the maximum height that this popup can have, including outer | ||
| /// borders. | ||
| /// | ||
| /// This is currently 80% of screen height. | ||
| pub fn popup_max_height(full_screen_height: u16) -> u16 { | ||
| (full_screen_height as u32 * 4 / 5) as u16 | ||
| } | ||
|
|
||
| /// Returns the maximum height that this popup can have, including outer | ||
| /// borders. | ||
| /// | ||
| /// This is currently 80% of screen height. | ||
| pub fn max_height(full_screen_height: u16) -> u16 { | ||
| (full_screen_height as u32 * 4 / 5) as u16 | ||
| /// Returns the wrap options that should be used in most cases for popups. | ||
| fn default_wrap_options( | ||
| full_screen_width: u16, | ||
| ) -> crate::ui::wrap::Options<'static> { | ||
| crate::ui::wrap::Options { | ||
| width: popup_max_content_width(full_screen_width) as usize, | ||
| // The indent here is to add 1 character of padding. | ||
| initial_indent: Span::raw(" "), | ||
| subsequent_indent: Span::raw(" "), | ||
| break_words: true, | ||
| } | ||
| } |
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.
These were moved outside Popup since it gained a type parameter -- static methods are annoying on structs with type parameters since you have to specify a concrete type even though it isn't relevant.
jgallagher
left a comment
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.
Sorry for the long delay on this review 😬
wicket/src/ui/panes/overview.rs
Outdated
|
|
||
| let popup_builder = | ||
| self.ignition.to_popup_builder(state.rack_state.selected); | ||
| // Scrolling in the ignition popup is always disabled. |
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.
Nit - this comment should probably be removed too, since the variant it was referencing is gone.
| self.ignition.to_popup_builder(state.rack_state.selected); | ||
|
|
||
| // The scroll offset here should always be disabled, but make it a | ||
| // parameter for uniformity with the other popups. |
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.
Nice to be able to delete this 👍
Created using spr 1.3.4
Model this with a new
PendingScrollaction stored on the view. Thisaction is resolved at draw time.
This ended up bundling several more changes (sorry!):
off previously, whoops :(
@jgallagher created while writing the rack setup screen. Previously,
we were storing a single scroll state at the top. This was actually
incorrect because when we moved from "waiting" to "failed", we weren't
setting the scroll state to Some. The new model stores scroll state
inline, and is correct as a result.
popups -- I made a couple of mistakes with unwrapping scroll popup
state which this caught.
I tested all the screens which support scrolling, and it worked great
on all of them.
Closes #3653.