mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 19:56:44 +01:00
Compare commits
4 commits
8bfd1a23a1
...
c954965ae1
| Author | SHA1 | Date | |
|---|---|---|---|
| c954965ae1 | |||
| f7306de55f | |||
| 4c039c999b | |||
| 496a9202d5 |
5 changed files with 32 additions and 11 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() {
|
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 exp_iter = exp_iter.clone();
|
let mut e = exp_iter.clone();
|
||||||
match exp_iter.next() {
|
match e.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 exp_iter) {
|
if let Some(command) = C::try_from_expr(state, &mut e) {
|
||||||
return Some(command)
|
return Some(command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => panic!("invalid config (expected symbol)")
|
_ => panic!("invalid config (expected symbol, got: {exp_iter:?})")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => panic!("invalid config (expected expression)")
|
_ => panic!("invalid config (expected expression, got: {next:?})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
|
|
|
||||||
18
output/src/ops/stack.rs
Normal file
18
output/src/ops/stack.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*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()
|
self.size().w()
|
||||||
}
|
}
|
||||||
fn height (&self) -> usize {
|
fn height (&self) -> usize {
|
||||||
self.size().w()
|
self.size().h()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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")
|
_ => panic!("only :symbols and (expressions) accepted here, got: {value:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn get_content_sym <'source: 'state> (&'state self, value: &Value<'source>)
|
fn get_content_sym <'source: 'state> (&'state self, value: &Value<'source>)
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,13 @@ 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::e(Bsp::s(row!(sep1, title, sep2), value), " ")
|
Bsp::n(
|
||||||
|
Align::w(value),
|
||||||
|
Fill::x(Align::w(row!(sep1, title, sep2)))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue