summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2021-04-19 21:26:33 +0200
committerCanop <cano.petrole@gmail.com>2021-04-19 21:26:33 +0200
commitc19ac0b692e481d6153c92ef6d1d7f9621132cda (patch)
treebd347acd8ecd4c02b6196d57de4fef62c9b44144 /src/app
parent553d8a597052d168673e319be863e9da7b6f0cd3 (diff)
Modal: Be back in command mode after executing a command
Fix #372
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app.rs8
-rw-r--r--src/app/panel.rs3
2 files changed, 6 insertions, 5 deletions
diff --git a/src/app/app.rs b/src/app/app.rs
index c18deb3..ff9c9c4 100644
--- a/src/app/app.rs
+++ b/src/app/app.rs
@@ -281,7 +281,7 @@ impl App {
}
ClosePanel { validate_purpose, panel_ref } => {
if is_input_invocation {
- self.mut_panel().clear_input_invocation();
+ self.mut_panel().clear_input_invocation(con);
}
let close_idx = self.panel_ref_to_idx(panel_ref)
.unwrap_or_else(||
@@ -366,7 +366,7 @@ impl App {
}
Keep => {
if is_input_invocation {
- self.mut_panel().clear_input_invocation();
+ self.mut_panel().clear_input_invocation(con);
}
}
Launch(launchable) => {
@@ -379,7 +379,7 @@ impl App {
direction,
} => {
if is_input_invocation {
- self.mut_panel().clear_input_invocation();
+ self.mut_panel().clear_input_invocation(con);
}
let insertion_idx = if purpose.is_preview() {
self.panels.len().get()
@@ -455,7 +455,7 @@ impl App {
}
RefreshState { clear_cache } => {
if is_input_invocation {
- self.mut_panel().clear_input_invocation();
+ self.mut_panel().clear_input_invocation(con);
}
if clear_cache {
clear_caches();
diff --git a/src/app/panel.rs b/src/app/panel.rs
index e638d38..1a410d4 100644
--- a/src/app/panel.rs
+++ b/src/app/panel.rs
@@ -162,13 +162,14 @@ impl Panel {
}
/// remove the verb invocation from the input but keep
/// the filter if there's one
- pub fn clear_input_invocation(&mut self) {
+ pub fn clear_input_invocation(&mut self, con: &AppContext) {
let mut command_parts = CommandParts::from(self.input.get_content());
if command_parts.verb_invocation.is_some() {
command_parts.verb_invocation = None;
let new_input = format!("{}", command_parts);
self.input.set_content(&new_input);
}
+ self.mut_state().set_mode(initial_mode(con));
}
pub fn set_input_content(&mut self, content: &str) {