From 587ec3fc913dd9d5760135dc3159f093082d694f Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Thu, 27 Jun 2019 00:22:41 +0300 Subject: [PATCH] debugger: Add history to repl --- src/debugger/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/debugger/mod.rs b/src/debugger/mod.rs index 483d15d..7cf47c6 100644 --- a/src/debugger/mod.rs +++ b/src/debugger/mod.rs @@ -291,6 +291,7 @@ impl Debugger { pub fn repl(&mut self) -> DebuggerResult<()> { self.running = true; let mut rl = Editor::<()>::new(); + rl.load_history(".rustboyadvance_history"); while self.running { let readline = rl.readline(&format!("({}) >> ", "rustboyadvance-dbg".cyan())); match readline { @@ -298,6 +299,7 @@ impl Debugger { if line.is_empty() { continue; } + rl.add_history_entry(line.as_str()); let expr = parse_expr(&line); match expr { Ok(expr) => self.eval_expr(expr), @@ -319,6 +321,7 @@ impl Debugger { } } } + rl.save_history(".rustboyadvance_history").unwrap(); Ok(()) } }