debugger: Add history to repl
This commit is contained in:
parent
f45a856835
commit
587ec3fc91
|
@ -291,6 +291,7 @@ impl Debugger {
|
||||||
pub fn repl(&mut self) -> DebuggerResult<()> {
|
pub fn repl(&mut self) -> DebuggerResult<()> {
|
||||||
self.running = true;
|
self.running = true;
|
||||||
let mut rl = Editor::<()>::new();
|
let mut rl = Editor::<()>::new();
|
||||||
|
rl.load_history(".rustboyadvance_history");
|
||||||
while self.running {
|
while self.running {
|
||||||
let readline = rl.readline(&format!("({}) >> ", "rustboyadvance-dbg".cyan()));
|
let readline = rl.readline(&format!("({}) >> ", "rustboyadvance-dbg".cyan()));
|
||||||
match readline {
|
match readline {
|
||||||
|
@ -298,6 +299,7 @@ impl Debugger {
|
||||||
if line.is_empty() {
|
if line.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
rl.add_history_entry(line.as_str());
|
||||||
let expr = parse_expr(&line);
|
let expr = parse_expr(&line);
|
||||||
match expr {
|
match expr {
|
||||||
Ok(expr) => self.eval_expr(expr),
|
Ok(expr) => self.eval_expr(expr),
|
||||||
|
@ -319,6 +321,7 @@ impl Debugger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rl.save_history(".rustboyadvance_history").unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue