Make rich text example editable
This commit is contained in:
parent
cce821e99f
commit
b9c01f1a81
1 changed files with 15 additions and 0 deletions
|
|
@ -157,6 +157,21 @@ fn main() {
|
|||
|
||||
for event in window.events() {
|
||||
match event.to_option() {
|
||||
EventOption::Key(event) => match event.scancode {
|
||||
orbclient::K_LEFT if event.pressed => buffer.action(TextAction::Left),
|
||||
orbclient::K_RIGHT if event.pressed => buffer.action(TextAction::Right),
|
||||
orbclient::K_UP if event.pressed => buffer.action(TextAction::Up),
|
||||
orbclient::K_DOWN if event.pressed => buffer.action(TextAction::Down),
|
||||
orbclient::K_HOME if event.pressed => buffer.action(TextAction::Home),
|
||||
orbclient::K_END if event.pressed => buffer.action(TextAction::End),
|
||||
orbclient::K_PGUP if event.pressed => buffer.action(TextAction::PageUp),
|
||||
orbclient::K_PGDN if event.pressed => buffer.action(TextAction::PageDown),
|
||||
orbclient::K_ENTER if event.pressed => buffer.action(TextAction::Enter),
|
||||
orbclient::K_BKSP if event.pressed => buffer.action(TextAction::Backspace),
|
||||
orbclient::K_DEL if event.pressed => buffer.action(TextAction::Delete),
|
||||
_ => (),
|
||||
},
|
||||
EventOption::TextInput(event) => buffer.action(TextAction::Insert(event.character)),
|
||||
EventOption::Mouse(mouse) => {
|
||||
mouse_x = mouse.x;
|
||||
mouse_y = mouse.y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue