From df95b239e78121ddf4314d47e1c20dad626752fb Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 18 Mar 2021 10:52:05 +0530 Subject: add history to command mode --- src/app.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/app.rs') diff --git a/src/app.rs b/src/app.rs index 0eac084..9ba93f4 100644 --- a/src/app.rs +++ b/src/app.rs @@ -248,6 +248,7 @@ impl<'ctx> AppState<'ctx> { } fn eval_command(&mut self) { + self.command_box.hist_append(); match self.command_box.text.as_str() { "(save)" => { let image = self.export(); @@ -648,7 +649,11 @@ impl<'ctx> AppState<'ctx> { Keycode::Delete => self.command_box.delete(), Keycode::Left => self.command_box.backward(), Keycode::Right => self.command_box.forward(), - Keycode::Return => self.eval_command(), + Keycode::Up => self.command_box.hist_prev(), + Keycode::Down => self.command_box.hist_next(), + Keycode::Return => { + self.eval_command(); + } Keycode::Escape => { self.command_box.clear(); self.mode = Mode::Draw; -- cgit v1.2.3