ui: add two readline shortcuts in text fields

This commit is contained in:
Manos Pitsidianakis 2019-10-20 11:22:47 +03:00
parent 1a02491f04
commit 565b11634a
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710

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;
}