From 565b11634a3daa0a28808a13cd8df2c9439f9b96 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 20 Oct 2019 11:22:47 +0300 Subject: [PATCH] ui: add two readline shortcuts in text fields --- ui/src/components/utilities/widgets.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/src/components/utilities/widgets.rs b/ui/src/components/utilities/widgets.rs index 3acdb9044..6d8c41db3 100644 --- a/ui/src/components/utilities/widgets.rs +++ b/ui/src/components/utilities/widgets.rs @@ -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; }