feat: rudimentary keyboard scrolling

I want smooth scrolling :(
This commit is contained in:
electria 2026-08-09 22:12:49 -07:00
commit 5f85338c72
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -142,6 +142,31 @@ impl State {
); );
} }
keyboard::Key::Character("j")
| keyboard::Key::Named(
keyboard::key::Named::ArrowDown | keyboard::key::Named::PageDown,
) => {
return widget::operation::scroll_by(
"main",
widget::operation::AbsoluteOffset {
x: 0.,
y: if modifiers.shift() { 100. } else { 30. },
},
);
}
keyboard::Key::Character("k")
| keyboard::Key::Named(
keyboard::key::Named::ArrowUp | keyboard::key::Named::PageUp,
) => {
return widget::operation::scroll_by(
"main",
widget::operation::AbsoluteOffset {
x: 0.,
y: if modifiers.shift() { -100. } else { -30. },
},
);
}
keyboard::Key::Character("=" | "+") => { keyboard::Key::Character("=" | "+") => {
self.columns = (self.columns + 1).clamp(1, 10) self.columns = (self.columns + 1).clamp(1, 10)
} }
@ -190,6 +215,7 @@ impl State {
})) }))
.columns(self.columns), .columns(self.columns),
) )
.id("main")
.height(Length::Fill) .height(Length::Fill)
.into(), .into(),
self.error.as_ref().map_or_else( self.error.as_ref().map_or_else(