summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2021-11-07 07:47:49 +0100
committerCanop <cano.petrole@gmail.com>2021-11-07 07:47:49 +0100
commit58f46fed19f3d8a87e27c5b3ba3bc363fbbbdc29 (patch)
tree6d39d06a5b1c202e38a2b5906e65f71d93924d20
parent335c2847d57ad8b89141da9060fe11524f29b9f4 (diff)
consider an input containing only spaces as empty on enter
Previously, when typing a space to start a verb, not typing it, then typing enter to open, a 'verb "" not found' message was displayed. Now the space is just ignored.
-rw-r--r--Cargo.lock2
-rw-r--r--src/command/panel_input.rs2
-rw-r--r--src/command/parts.rs5
3 files changed, 7 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 4b15586..566fba8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -140,7 +140,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "broot"
-version = "1.7.0"
+version = "1.7.1"
dependencies = [
"ahash 0.7.4",
"ansi_colours",
diff --git a/src/command/panel_input.rs b/src/command/panel_input.rs
index 419447b..879b7fb 100644
--- a/src/command/panel_input.rs
+++ b/src/command/panel_input.rs
@@ -298,7 +298,7 @@ impl PanelInput {
self.input_before_cycle = None;
}
- if key == keys::ENTER && parts.verb_invocation.is_some() {
+ if key == keys::ENTER && parts.has_not_empty_verb_invocation() {
return Command::from_parts(parts, true);
}
diff --git a/src/command/parts.rs b/src/command/parts.rs
index a82e3ad..b355de5 100644
--- a/src/command/parts.rs
+++ b/src/command/parts.rs
@@ -26,6 +26,11 @@ impl fmt::Display for CommandParts {
}
impl CommandParts {
+ pub fn has_not_empty_verb_invocation(&self) -> bool {
+ self.verb_invocation
+ .as_ref()
+ .map_or(false, |vi| !vi.is_empty())
+ }
pub fn from(mut raw: String) -> Self {
let mut invocation_start_pos: Option<usize> = None;
let mut escaping = false;