Compare commits

..

No commits in common. "c954965ae125136286291e5f0d4532edf98f46ad" and "8bfd1a23a1f880a1d2fb104a158fc51f244acd6e" have entirely different histories.

5 changed files with 11 additions and 32 deletions

View file

@ -51,19 +51,19 @@ impl<'state, S, C: DslCommand<'state, S>, I: DslInput> KeyMap<'state, S, C, I> f
while let Some(next) = iter.next() { while let Some(next) = iter.next() {
match next { match next {
Token { value: Value::Exp(0, exp_iter), .. } => { Token { value: Value::Exp(0, exp_iter), .. } => {
let mut e = exp_iter.clone(); let mut exp_iter = exp_iter.clone();
match e.next() { match exp_iter.next() {
Some(Token { value: Value::Sym(binding), .. }) => { Some(Token { value: Value::Sym(binding), .. }) => {
if input.matches_dsl(binding) { if input.matches_dsl(binding) {
if let Some(command) = C::try_from_expr(state, &mut e) { if let Some(command) = C::try_from_expr(state, &mut exp_iter) {
return Some(command) return Some(command)
} }
} }
}, },
_ => panic!("invalid config (expected symbol, got: {exp_iter:?})") _ => panic!("invalid config (expected symbol)")
} }
}, },
_ => panic!("invalid config (expected expression, got: {next:?})") _ => panic!("invalid config (expected expression)")
} }
} }
None None

View file

@ -1,18 +0,0 @@
/*Stack::down(|add|{
let mut i = 0;
for (_, name) in self.dirs.iter() {
if i >= self.scroll {
add(&Tui::bold(i == self.index, name.as_str()))?;
}
i += 1;
}
for (_, name) in self.files.iter() {
if i >= self.scroll {
add(&Tui::bold(i == self.index, name.as_str()))?;
}
i += 1;
}
add(&format!("{}/{i}", self.index))?;
Ok(())
}));*/

View file

@ -7,7 +7,7 @@ pub trait HasSize<E: Output> {
self.size().w() self.size().w()
} }
fn height (&self) -> usize { fn height (&self) -> usize {
self.size().h() self.size().w()
} }
} }

View file

@ -54,7 +54,7 @@ pub trait ViewContext<'state, E: Output + 'state>: Send + Sync
match value { match value {
Value::Sym(_) => self.get_content_sym(value), Value::Sym(_) => self.get_content_sym(value),
Value::Exp(_, _) => self.get_content_exp(value), Value::Exp(_, _) => self.get_content_exp(value),
_ => panic!("only :symbols and (expressions) accepted here, got: {value:?}") _ => panic!("only :symbols and (expressions) accepted here")
} }
} }
fn get_content_sym <'source: 'state> (&'state self, value: &Value<'source>) fn get_content_sym <'source: 'state> (&'state self, value: &Value<'source>)

View file

@ -17,13 +17,10 @@ pub struct FieldV<T, U>(pub ItemTheme, pub T, pub U);
impl<T: Content<TuiOut>, U: Content<TuiOut>> Content<TuiOut> for FieldV<T, U> { impl<T: Content<TuiOut>, U: Content<TuiOut>> Content<TuiOut> for FieldV<T, U> {
fn content (&self) -> impl Render<TuiOut> { fn content (&self) -> impl Render<TuiOut> {
let Self(ItemTheme { darkest, dark, lighter, lightest, .. }, title, value) = self; let Self(ItemTheme { darkest, dark, lighter, lightest, .. }, title, value) = self;
let sep1 = Tui::bg(darkest.rgb, Tui::fg(dark.rgb, "")); let sep1 = Tui::bg(darkest.rgb, Tui::fg(dark.rgb, ""));
let sep2 = Tui::bg(darkest.rgb, Tui::fg(dark.rgb, "")); let sep2 = Tui::bg(darkest.rgb, Tui::fg(dark.rgb, ""));
let title = Tui::bg(dark.rgb, Tui::fg(lighter.rgb, Tui::bold(true, title))); let title = Tui::bg(dark.rgb, Tui::fg(lighter.rgb, Tui::bold(true, title)));
let value = Tui::bg(darkest.rgb, Tui::fg(lightest.rgb, value)); let value = Tui::bg(darkest.rgb, Tui::fg(lightest.rgb, value));
Bsp::n( Bsp::e(Bsp::s(row!(sep1, title, sep2), value), " ")
Align::w(value),
Fill::x(Align::w(row!(sep1, title, sep2)))
)
} }
} }