TextEdit: left/right arrows move cursor to start/end of selection
Closes https://github.com/emilk/egui/issues/611
This commit is contained in:
parent
2382425198
commit
f9afdfa143
1 changed files with 9 additions and 0 deletions
|
@ -1135,6 +1135,15 @@ fn on_key_press<S: TextBuffer>(
|
||||||
Some(CCursorPair::one(ccursor))
|
Some(CCursorPair::one(ccursor))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Key::ArrowLeft | Key::ArrowRight if modifiers.is_none() && !cursorp.is_empty() => {
|
||||||
|
if key == Key::ArrowLeft {
|
||||||
|
*cursorp = CursorPair::one(cursorp.sorted()[0]);
|
||||||
|
} else {
|
||||||
|
*cursorp = CursorPair::one(cursorp.sorted()[1]);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
Key::ArrowLeft | Key::ArrowRight | Key::ArrowUp | Key::ArrowDown | Key::Home | Key::End => {
|
Key::ArrowLeft | Key::ArrowRight | Key::ArrowUp | Key::ArrowDown | Key::Home | Key::End => {
|
||||||
move_single_cursor(&mut cursorp.primary, galley, key, modifiers);
|
move_single_cursor(&mut cursorp.primary, galley, key, modifiers);
|
||||||
if !modifiers.shift {
|
if !modifiers.shift {
|
||||||
|
|
Loading…
Reference in a new issue