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