Refactor history handling: store only save and usefull commands, save them in LKEval state, do not safe pass command into history.

This commit is contained in:
Oleksandr Kozachuk
2023-01-07 13:16:47 +01:00
parent 4ee1d38be7
commit 2b56aed28e
4 changed files with 90 additions and 56 deletions
+7 -3
View File
@@ -91,6 +91,10 @@ pub mod home {
pub mod editor {
use crate::structs::LKErr;
use rustyline::error::ReadlineError;
use std::sync::Arc;
use parking_lot::Mutex;
pub type EditorRef = Arc<Mutex<Editor>>;
#[derive(Debug)]
pub struct Editor {
@@ -98,10 +102,10 @@ pub mod editor {
}
impl Editor {
pub fn new() -> Self {
Self {
pub fn new() -> EditorRef {
Arc::new(Mutex::new(Self {
editor: rustyline::Editor::<()>::new().unwrap(),
}
}))
}
pub fn clear_history(&mut self) {