Early implementation of syntax highlighting

Various bug fixes related to command substitution
This commit is contained in:
2025-04-21 01:56:05 -04:00
parent c8be5205e9
commit 37e746cb90
6 changed files with 201 additions and 63 deletions

View File

@@ -1,13 +1,12 @@
use std::borrow::Cow;
use rustyline::{completion::Completer, highlight::Highlighter, hint::{Hint, Hinter}, validate::{ValidationResult, Validator}, Helper};
use rustyline::{completion::Completer, hint::{Hint, Hinter}, validate::{ValidationResult, Validator}, Helper};
use crate::{libsh::term::{Style, Styled}, parse::{lex::{LexFlags, LexStream}, ParseStream}};
use crate::prelude::*;
#[derive(Default,Debug)]
pub struct FernReadline {
}
pub struct FernReadline;
impl FernReadline {
pub fn new() -> Self {
@@ -59,12 +58,6 @@ impl Hinter for FernReadline {
}
}
impl Highlighter for FernReadline {
fn highlight<'l>(&self, line: &'l str, _pos: usize) -> std::borrow::Cow<'l, str> {
Cow::Owned(line.to_string())
}
}
impl Validator for FernReadline {
fn validate(&self, ctx: &mut rustyline::validate::ValidationContext) -> rustyline::Result<rustyline::validate::ValidationResult> {
let mut tokens = vec![];