diff options
| author | Jonas Maier <> | 2026-03-05 06:42:14 +0100 |
|---|---|---|
| committer | Jonas Maier <> | 2026-03-05 06:42:14 +0100 |
| commit | 61b7a2002d30d055465adf3a1acf548750508054 (patch) | |
| tree | 67b72779fee559d984feec0a126da0b028fda440 /src/main.rs | |
| parent | 9d7a203118204ed71eb56834c9b8fa7709835fc0 (diff) | |
| download | pish-61b7a2002d30d055465adf3a1acf548750508054.tar.gz | |
handle double spaces
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 4 |
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; |
