From 9d7a203118204ed71eb56834c9b8fa7709835fc0 Mon Sep 17 00:00:00 2001 From: Jonas Maier <> Date: Wed, 4 Mar 2026 18:08:43 +0100 Subject: no enter spam, proper exit --- src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main.rs') 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) { 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!(); } -- cgit v1.2.3