diff options
| author | Jonas Maier <> | 2026-03-04 18:08:43 +0100 |
|---|---|---|
| committer | Jonas Maier <> | 2026-03-04 18:08:43 +0100 |
| commit | 9d7a203118204ed71eb56834c9b8fa7709835fc0 (patch) | |
| tree | f7dbf585ee52f7a460ff8839b4acfa5b5b440fc8 | |
| parent | 9e8d6c77fe768423340beab8ed4ef4e4dd7187df (diff) | |
| download | pish-9d7a203118204ed71eb56834c9b8fa7709835fc0.tar.gz | |
no enter spam, proper exit
| -rw-r--r-- | src/main.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index cd934d0..53337c8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -146,7 +146,7 @@ fn run_command(raw: &ScopedRawMode, line: Vec<u8>) { None => todo!("homedir"), }; - if let Err(e) = std::env::set_current_dir(target) { + if let Err(_) = std::env::set_current_dir(target) { print!("ERR {PROMPT}"); } else { print!("{PROMPT}"); @@ -209,9 +209,11 @@ fn main() { // Enter b'\r' => { - print!("\r\n"); let line = line.dump(); - run_command(&raw, line); + if !line.is_empty() { + print!("\r\n"); + run_command(&raw, line); + } } // Backspace (127 on most systems) @@ -242,7 +244,7 @@ fn main() { move_cursor(Direction::Left, 1); line.left(); } - _ => {} + x => todo!("escape character {x}") } } } @@ -255,4 +257,7 @@ fn main() { } } } + + raw.disable(); + println!(); } |
