Skip to content

Commit

Permalink
Fix the behavior of Ctrl-C and Ctrl-D
Browse files Browse the repository at this point in the history
  • Loading branch information
buty4649 committed Nov 18, 2021
1 parent a3d7209 commit 577b95c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/app.rs
Expand Up @@ -124,8 +124,12 @@ impl<'a> App {
for cmd in cmds.to_vec() {
executor.execute_command(cmd, None);
}
linenumber += cmdline.split('\n').count();
cmdline = String::new()

if rl.keep_linenumer() {
linenumber += cmdline.split('\n').count();
}

cmdline.clear()
}
Err(e) => {
match e.value() {
Expand All @@ -135,9 +139,13 @@ impl<'a> App {
}
}
}
Err(ReadLineError::Interrupted) => (),
Err(ReadLineError::Interrupted) => cmdline.clear(),
Err(ReadLineError::Eof) => {
break;
if cmdline.is_empty() {
break;
} else {
cmdline.clear()
}
}
Err(err) => {
println!("Error: {:?}", err);
Expand Down

0 comments on commit 577b95c

Please sign in to comment.