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

Added Ctrl+Home and Ctrl+End shortcuts to Editbox #793

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/ui/widgets/editbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,40 @@ impl<'a> Editbox<'a> {
}
InputCharacter {
key: Key::KeyCode(Home),
modifier_ctrl: false,
modifier_shift,
..
} => {
let to_line_begin = state.find_line_begin(text) as i32;
state.move_cursor(text, -to_line_begin, modifier_shift);
}
InputCharacter {
key: Key::KeyCode(Home),
modifier_ctrl: true,
modifier_shift,
..
} => {
let to_text_being = state.cursor as i32;
state.move_cursor(text, -to_text_being, modifier_shift);
}
InputCharacter {
key: Key::KeyCode(End),
modifier_ctrl: false,
modifier_shift,
..
} => {
let to_line_end = state.find_line_end(text) as i32;
state.move_cursor(text, to_line_end, modifier_shift);
}
InputCharacter {
key: Key::KeyCode(End),
modifier_ctrl: true,
modifier_shift,
..
} => {
let to_text_end = (text.len() as u32 - state.cursor) as i32;
state.move_cursor(text, to_text_end, modifier_shift);
}
InputCharacter {
key: Key::KeyCode(Up),
modifier_shift,
Expand Down
Loading