mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-08 04:36:49 +01:00
Compare commits
No commits in common. "c954965ae125136286291e5f0d4532edf98f46ad" and "8bfd1a23a1f880a1d2fb104a158fc51f244acd6e" have entirely different histories.
c954965ae1
...
8bfd1a23a1
5 changed files with 11 additions and 32 deletions
|
|
@ -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() {
|
||||
match next {
|
||||
Token { value: Value::Exp(0, exp_iter), .. } => {
|
||||
let mut e = exp_iter.clone();
|
||||
match e.next() {
|
||||
let mut exp_iter = exp_iter.clone();
|
||||
match exp_iter.next() {
|
||||
Some(Token { value: Value::Sym(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)
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => 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
|
||||
|
|
|
|||
|
|
@ -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(())
|
||||
}));*/
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ pub trait HasSize<E: Output> {
|
|||
self.size().w()
|
||||
}
|
||||
fn height (&self) -> usize {
|
||||
self.size().h()
|
||||
self.size().w()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ pub trait ViewContext<'state, E: Output + 'state>: Send + Sync
|
|||
match value {
|
||||
Value::Sym(_) => self.get_content_sym(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>)
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
let Self(ItemTheme { darkest, dark, lighter, lightest, .. }, title, value) = self;
|
||||
let sep1 = 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 sep1 = 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 value = Tui::bg(darkest.rgb, Tui::fg(lightest.rgb, value));
|
||||
Bsp::n(
|
||||
Align::w(value),
|
||||
Fill::x(Align::w(row!(sep1, title, sep2)))
|
||||
)
|
||||
Bsp::e(Bsp::s(row!(sep1, title, sep2), value), " ")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue