Skip to content

Commit

Permalink
Change ^C to just abort current input
Browse files Browse the repository at this point in the history
Don't exit the program any more. This mirrors what shells do, and is
useful for aborting a reverse search or a too broken input.
  • Loading branch information
martinpitt committed Jun 13, 2022
1 parent 832b4ad commit 449de70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ fn get_input(rl: &mut Editor<()>) -> Result<String, ReadlineError> {
line.truncate(line.trim_end().len());
Ok(line)
}
Err(ReadlineError::Interrupted) | Err(ReadlineError::Eof) => Ok(":q".to_string()),
// ^C: like in a shell, abort the current input
Err(ReadlineError::Interrupted) => Ok("".to_string()),
Err(ReadlineError::Eof) => Ok(":q".to_string()),
Err(e) => Err(e),
}
}
Expand Down

0 comments on commit 449de70

Please sign in to comment.