implemented history for the line editor
This commit is contained in:
@@ -14,18 +14,18 @@ fn get_prompt() -> ShResult<String> {
|
||||
//
|
||||
// username@hostname
|
||||
// short/path/to/pwd/
|
||||
// $
|
||||
// $ _
|
||||
let default = "\\n\\e[1;0m\\u\\e[1;36m@\\e[1;31m\\h\\n\\e[1;36m\\W\\e[1;32m/\\n\\e[1;32m\\$\\e[0m ";
|
||||
return Ok(format!("{}",expand_prompt(default)?))
|
||||
return expand_prompt(default)
|
||||
};
|
||||
|
||||
Ok(format!("\n{}",expand_prompt(&prompt)?))
|
||||
expand_prompt(&prompt)
|
||||
}
|
||||
|
||||
pub fn read_line(edit_mode: FernEditMode) -> ShResult<String> {
|
||||
let prompt = get_prompt()?;
|
||||
let mut reader: Box<dyn Readline> = match edit_mode {
|
||||
FernEditMode::Vi => Box::new(FernVi::new(Some(prompt))),
|
||||
FernEditMode::Vi => Box::new(FernVi::new(Some(prompt))?),
|
||||
FernEditMode::Emacs => todo!()
|
||||
};
|
||||
reader.readline()
|
||||
|
||||
Reference in New Issue
Block a user