Few more linefeed-related changes
This commit is contained in:
parent
4eb7683f47
commit
d7181afa91
14
src/main.rs
14
src/main.rs
@ -97,7 +97,7 @@ struct Repl<'a> {
|
|||||||
|
|
||||||
impl<'a> Repl<'a> {
|
impl<'a> Repl<'a> {
|
||||||
fn new(trace_evaluation: bool) -> Repl<'a> {
|
fn new(trace_evaluation: bool) -> Repl<'a> {
|
||||||
let mut reader: linefeed::Reader<_> = linefeed::Reader::new("").unwrap();
|
let mut reader: linefeed::Reader<_> = linefeed::Reader::new("Schala").unwrap();
|
||||||
reader.set_prompt(">> ");
|
reader.set_prompt(">> ");
|
||||||
Repl {
|
Repl {
|
||||||
show_tokens: false,
|
show_tokens: false,
|
||||||
@ -114,25 +114,23 @@ impl<'a> Repl<'a> {
|
|||||||
loop {
|
loop {
|
||||||
match self.reader.read_line() {
|
match self.reader.read_line() {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Terminal read error: {:?}", e);
|
println!("Terminal read error: {}", e);
|
||||||
break;
|
|
||||||
},
|
},
|
||||||
Ok(Eof) => {
|
Ok(Eof) => {
|
||||||
println!("Exiting...");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Ok(Input(ref input)) => {
|
Ok(Input(ref input)) => {
|
||||||
|
self.reader.add_history(input.clone());
|
||||||
if self.handle_interpreter_directive(input) {
|
if self.handle_interpreter_directive(input) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let output = self.input_handler(input);
|
let output = self.input_handler(input);
|
||||||
println!("{}", output);
|
println!("=> {}", output);
|
||||||
}
|
}
|
||||||
Ok(Signal(signal)) => {
|
_ => (),
|
||||||
println!("Received signal: {:?}", signal);
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
println!("Exiting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn input_handler(&mut self, input: &str) -> String {
|
fn input_handler(&mut self, input: &str) -> String {
|
||||||
|
Loading…
Reference in New Issue
Block a user