reset current input in ReadQueryTerm
This commit is contained in:
@@ -540,7 +540,10 @@ impl Stream {
|
||||
|
||||
// returns true on success.
|
||||
#[inline]
|
||||
pub(super)
|
||||
fn reset(&mut self) -> bool {
|
||||
self.stream_inst.0.borrow_mut().0 = false;
|
||||
|
||||
match self.stream_inst.0.borrow_mut().1 {
|
||||
StreamInstance::Bytes(ref mut cursor) => {
|
||||
cursor.set_position(0);
|
||||
@@ -550,8 +553,7 @@ impl Stream {
|
||||
file.seek(SeekFrom::Start(0)).unwrap();
|
||||
true
|
||||
}
|
||||
StreamInstance::ReadlineStream(ref mut stream) => {
|
||||
*stream = ReadlineStream::new(String::new());
|
||||
StreamInstance::ReadlineStream(_) => {
|
||||
true
|
||||
}
|
||||
_ => {
|
||||
|
||||
@@ -4235,6 +4235,8 @@ impl MachineState {
|
||||
}
|
||||
}
|
||||
&SystemClauseType::ReadQueryTerm => {
|
||||
current_input_stream.reset();
|
||||
|
||||
readline::set_prompt(true);
|
||||
let result = self.read_term(current_input_stream.clone(), indices);
|
||||
readline::set_prompt(false);
|
||||
|
||||
@@ -42,11 +42,6 @@ pub mod readline {
|
||||
}
|
||||
|
||||
impl ReadlineStream {
|
||||
pub fn new(pending_input: String) -> Self {
|
||||
let rl = Editor::<()>::new();
|
||||
ReadlineStream { rl, pending_input: Cursor::new(pending_input) }
|
||||
}
|
||||
|
||||
pub fn input_stream(pending_input: String) -> Stream {
|
||||
let mut rl = Editor::<()>::new();
|
||||
rl.bind_sequence(KeyPress::Tab, Cmd::Insert(1, "\t".to_string()));
|
||||
|
||||
Reference in New Issue
Block a user