implemented for loops

This commit is contained in:
2025-04-20 05:16:50 -04:00
parent b6be68b235
commit 4d16ffa60f
27 changed files with 360 additions and 174 deletions

View File

@@ -80,7 +80,7 @@ pub fn read_line() -> ShResult<String> {
}
Err(ReadlineError::Interrupted) => Ok(String::new()),
Err(e) => {
return Err(e.into())
Err(e.into())
}
}
}

View File

@@ -5,12 +5,13 @@ use rustyline::{completion::Completer, highlight::Highlighter, hint::{Hint, Hint
use crate::{libsh::term::{Style, Styled}, parse::{lex::{LexFlags, LexStream}, ParseStream}};
use crate::prelude::*;
#[derive(Default,Debug)]
pub struct FernReadline {
}
impl FernReadline {
pub fn new() -> Self {
Self { }
Self::default()
}
}
@@ -50,7 +51,7 @@ impl Hinter for FernReadline {
fn hint(&self, line: &str, pos: usize, ctx: &rustyline::Context<'_>) -> Option<Self::Hint> {
let ent = ctx.history().search(
line,
ctx.history().len() - 1,
ctx.history().len().saturating_sub(1),
rustyline::history::SearchDirection::Reverse
).ok()??;
let entry_raw = ent.entry.get(pos..)?.to_string();