ui: add two readline shortcuts in text fields

embed
Manos Pitsidianakis 2019-10-20 11:22:47 +03:00
parent 1a02491f04
commit 565b11634a
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 11 additions and 0 deletions

View File

@ -187,6 +187,17 @@ impl Component for Field {
}
}
}
UIEvent::InsertInput(Key::Ctrl('a')) => {
if let Text(ref mut s, _) = self {
s.set_cursor(0);
}
}
UIEvent::InsertInput(Key::Ctrl('e')) => {
if let Text(ref mut s, _) = self {
s.set_cursor(s.as_str().len());
}
}
/* TODO: add rest of readline shortcuts */
_ => {
return false;
}