diff options
author | sushi-shi <47691267+sushi-shi@users.noreply.github.com> | 2022-02-23 20:39:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-23 12:39:46 -0500 |
commit | fe3308c75da696b37c970c12ef9cefe942fa8377 (patch) | |
tree | b4baefda219918cd9603b7dc3e1d2ab222eb28c1 /src/ui | |
parent | 1a78bb897a191ce5e816bf690be52ec03222369f (diff) |
Add incremental search (#140)
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/views/tui_textfield.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/views/tui_textfield.rs b/src/ui/views/tui_textfield.rs index 153a903..7c481e7 100644 --- a/src/ui/views/tui_textfield.rs +++ b/src/ui/views/tui_textfield.rs @@ -1,3 +1,5 @@ +use std::str::FromStr; + use rustyline::completion::{Candidate, Completer, FilenameCompleter, Pair}; use rustyline::line_buffer; @@ -8,7 +10,7 @@ use unicode_width::UnicodeWidthStr; use crate::context::AppContext; use crate::event::AppEvent; -use crate::key_command::complete_command; +use crate::key_command::{complete_command, Command, InteractiveExecute}; use crate::ui::views::TuiView; use crate::ui::widgets::{TuiMenu, TuiMultilineText}; use crate::ui::TuiBackend; @@ -270,6 +272,10 @@ impl<'a> TuiTextField<'a> { if line_buffer.insert(c, 1).is_some() { completion_tracker.take(); } + + if let Ok(command) = Command::from_str(line_buffer.as_str()) { + command.interactive_execute(context) + } } _ => {} } |