improve the handling of complete and incomplete commands in input.rs
This commit is contained in:
parent
831f7032ce
commit
223a53cf9a
1 changed files with 11 additions and 14 deletions
|
@ -158,20 +158,17 @@ impl InputReader {
|
|||
}
|
||||
};
|
||||
|
||||
match cmd {
|
||||
Command::Query(_) |
|
||||
Command::Transact(_) if !cmd.is_complete().0 => {
|
||||
let (is_complete, _) = cmd.is_complete();
|
||||
if is_complete {
|
||||
self.buffer.clear();
|
||||
self.in_process_cmd = None;
|
||||
Ok(InputResult::MetaCommand(cmd))
|
||||
} else {
|
||||
// a query or transact is complete if it contains a valid edn.
|
||||
// if the command is not complete, ask for more from the repl and remember
|
||||
// which type of command we've found here.
|
||||
self.in_process_cmd = Some(cmd);
|
||||
Ok(More)
|
||||
},
|
||||
_ => {
|
||||
self.buffer.clear();
|
||||
self.in_process_cmd = None;
|
||||
Ok(InputResult::MetaCommand(cmd))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue