diff options
author | Akshay <[email protected]> | 2021-05-17 12:25:09 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-05-17 12:25:09 +0100 |
commit | d2cc31ee49d673f343ce5089071ef3628c3cdc97 (patch) | |
tree | a654f312f0d6b66c52c9dda8882b6e954e97988f /src/app.rs | |
parent | 09ee8cc84251d1758766dedff9e25497eebb88d8 (diff) |
add tab to complete env variables
Diffstat (limited to 'src/app.rs')
-rw-r--r-- | src/app.rs | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -27,7 +27,6 @@ use std::{ | |||
27 | path::{Path, PathBuf}, | 27 | path::{Path, PathBuf}, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | use log::info; | ||
31 | use obi::{CompressionType, Image}; | 30 | use obi::{CompressionType, Image}; |
32 | use sdl2::{ | 31 | use sdl2::{ |
33 | event::Event, | 32 | event::Event, |
@@ -319,10 +318,7 @@ impl<'ctx> AppState<'ctx> { | |||
319 | } | 318 | } |
320 | 319 | ||
321 | pub fn eval_expr(&mut self, expr: &LispExpr) { | 320 | pub fn eval_expr(&mut self, expr: &LispExpr) { |
322 | let mut evaluator = eval::Evaluator { | 321 | let mut evaluator = eval::Evaluator::new(self); |
323 | app: self, | ||
324 | context: Vec::new(), | ||
325 | }; | ||
326 | match evaluator.eval(expr) { | 322 | match evaluator.eval(expr) { |
327 | Ok(val) => self.message.set_info(format!("{}", val)), | 323 | Ok(val) => self.message.set_info(format!("{}", val)), |
328 | Err(eval_err) => self.message.set_error(format!("{}", eval_err)), | 324 | Err(eval_err) => self.message.set_error(format!("{}", eval_err)), |
@@ -745,7 +741,6 @@ impl<'ctx> AppState<'ctx> { | |||
745 | self.mode = Mode::Command; | 741 | self.mode = Mode::Command; |
746 | } | 742 | } |
747 | } | 743 | } |
748 | info!("key press: {:?}", &event); | ||
749 | match self.mode { | 744 | match self.mode { |
750 | Mode::Draw => { | 745 | Mode::Draw => { |
751 | match event { | 746 | match event { |
@@ -1047,6 +1042,7 @@ impl<'ctx> AppState<'ctx> { | |||
1047 | Keycode::Up => self.command_box.hist_prev(), | 1042 | Keycode::Up => self.command_box.hist_prev(), |
1048 | Keycode::Down => self.command_box.hist_next(), | 1043 | Keycode::Down => self.command_box.hist_next(), |
1049 | Keycode::Return => self.eval_command(), | 1044 | Keycode::Return => self.eval_command(), |
1045 | Keycode::Tab => self.command_box.complete_next(&self.lisp_env), | ||
1050 | Keycode::Escape => { | 1046 | Keycode::Escape => { |
1051 | self.command_box.clear(); | 1047 | self.command_box.clear(); |
1052 | self.message.text.clear(); | 1048 | self.message.text.clear(); |
@@ -1062,11 +1058,11 @@ impl<'ctx> AppState<'ctx> { | |||
1062 | _ => (), | 1058 | _ => (), |
1063 | }, | 1059 | }, |
1064 | // how does one handle alt keys | 1060 | // how does one handle alt keys |
1065 | // _ if keymod == Mod::LALTMOD => match k { | 1061 | _ if keymod == Mod::LALTMOD => match k { |
1066 | // Keycode::B => self.command_box.cursor_back_word(), | 1062 | Keycode::B => self.command_box.cursor_back_word(), |
1067 | // Keycode::F => self.command_box.cursor_forward_word(), | 1063 | Keycode::F => self.command_box.cursor_forward_word(), |
1068 | // _ => (), | 1064 | _ => (), |
1069 | // }, | 1065 | }, |
1070 | _ => (), | 1066 | _ => (), |
1071 | }, | 1067 | }, |
1072 | Event::TextInput { text, .. } => { | 1068 | Event::TextInput { text, .. } => { |