Support tab for indent/un-indent

This commit is contained in:
Jeremy Soller 2023-11-01 13:33:10 -06:00
parent 621e9d75eb
commit f6abeb32e4
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
2 changed files with 26 additions and 18 deletions

View file

@ -405,6 +405,14 @@ where
editor.action(Action::Delete);
status = Status::Captured;
}
KeyCode::Tab => {
if modifiers.shift() {
editor.action(Action::Unindent);
} else {
editor.action(Action::Indent);
}
status = Status::Captured;
}
_ => (),
},
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
@ -414,7 +422,7 @@ where
// Only parse keys when Super, Ctrl, and Alt are not pressed
if !state.modifiers.logo() && !state.modifiers.control() && !state.modifiers.alt() {
match character {
'\n' | '\r' => {}
'\n' | '\r' | '\t' => {}
_ => {
editor.action(Action::Insert(character));
}