Fix swapped mapping Ctrl+D/Ctrl+C in REPL
@@ -314,7 +314,7 @@ pub mod rustyline_frontend {
use rustyline::config::OutputStreamType;
use rustyline::error::ReadlineError;
use rustyline::validate::{ValidationContext, ValidationResult, Validator};
- use rustyline::{Config, EditMode, Editor, KeyEvent};
+ use rustyline::{Config, EditMode, Editor};
use rustyline_derive::{Completer, Helper, Highlighter, Hinter};
/// Validator enabling multiline input.
@@ -394,7 +394,6 @@ pub mod rustyline_frontend {
let mut editor = Editor::with_config(config());
editor.set_helper(Some(validator));
- editor.bind_sequence(KeyEvent::ctrl('d'), rustyline::Cmd::AcceptLine);
let prompt = Style::new().fg(Colour::Green).paint("nickel> ").to_string();
loop {
@@ -443,15 +442,15 @@ pub mod rustyline_frontend {
Ok(line) => {
match repl.eval(&line) {
Ok(EvalResult::Evaluated(t)) => println!("{}\n", t.shallow_repr()),
- Ok(EvalResult::Bound(_)) => println!(),
+ Ok(EvalResult::Bound(_)) => (),
Err(err) => program::report(repl.cache_mut(), err),
};
}
- Err(ReadlineError::Interrupted) => {
- println!("{}", Style::new().bold().paint("Interrupted. Exiting"));
+ Err(ReadlineError::Eof) => {
+ println!("{}", Style::new().bold().paint("Ctrl+D. Exiting"));
break Ok(());
}
- Err(ReadlineError::Eof) => (),
+ Err(ReadlineError::Interrupted) => (),
Err(err) => {
program::report(
repl.cache_mut(),
