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 {
|
let (is_complete, _) = cmd.is_complete();
|
||||||
Command::Query(_) |
|
if is_complete {
|
||||||
Command::Transact(_) if !cmd.is_complete().0 => {
|
self.buffer.clear();
|
||||||
// a query or transact is complete if it contains a valid edn.
|
self.in_process_cmd = None;
|
||||||
// if the command is not complete, ask for more from the repl and remember
|
Ok(InputResult::MetaCommand(cmd))
|
||||||
// which type of command we've found here.
|
} else {
|
||||||
self.in_process_cmd = Some(cmd);
|
// a query or transact is complete if it contains a valid edn.
|
||||||
Ok(More)
|
// 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);
|
||||||
self.buffer.clear();
|
Ok(More)
|
||||||
self.in_process_cmd = None;
|
|
||||||
Ok(InputResult::MetaCommand(cmd))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue