aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Maier <>2026-03-05 06:42:14 +0100
committerJonas Maier <>2026-03-05 06:42:14 +0100
commit61b7a2002d30d055465adf3a1acf548750508054 (patch)
tree67b72779fee559d984feec0a126da0b028fda440
parent9d7a203118204ed71eb56834c9b8fa7709835fc0 (diff)
downloadpish-61b7a2002d30d055465adf3a1acf548750508054.tar.gz
handle double spaces
-rw-r--r--src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 53337c8..3017995 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -130,7 +130,9 @@ pub struct CursorPos {
const PROMPT: &str = "> ";
fn run_command(raw: &ScopedRawMode, line: Vec<u8>) {
- let words: Vec<&[u8]> = line.split(|x| *x == b' ').collect();
+ let mut words: Vec<&[u8]> = line.split(|x| *x == b' ').collect();
+ words.retain(|w| !w.is_empty());
+
if words.is_empty() {
print!("{PROMPT}");
return;