mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-07-17 15:56:57 +02:00
wip: impl_draw, optional drawing
This commit is contained in:
parent
0b9e9c0696
commit
bf16288884
12 changed files with 213 additions and 229 deletions
37
src/eval.rs
37
src/eval.rs
|
|
@ -114,22 +114,23 @@ pub fn eval_view <'a, O: Screen + 'a, S> (
|
|||
).draw(output),
|
||||
|
||||
// Second `frags.next()` calls returns the namespace member.
|
||||
Some("bsp") => eval_enum!(
|
||||
"bsp", output, state, frags.next(), arg0, Split {
|
||||
Some("bsp") => {
|
||||
let direction = eval_enum!("bsp", output, state, frags.next(), arg0, Split {
|
||||
"n" => North, "s" => South, "e" => East, "w" => West, "a" => Above, "b" => Below
|
||||
}
|
||||
).half(
|
||||
thunk(move|output: &mut O|state.interpret(output, &arg0)),
|
||||
thunk(move|output: &mut O|state.interpret(output, &arg1)),
|
||||
).draw(output),
|
||||
});
|
||||
direction.half(
|
||||
thunk(move|output: &mut O|state.interpret(output, &arg0)),
|
||||
thunk(move|output: &mut O|state.interpret(output, &arg1)),
|
||||
).draw(output)
|
||||
},
|
||||
|
||||
Some("align") => eval_enum!(
|
||||
"align", output, state, frags.next(), arg0, Origin {
|
||||
Some("align") => {
|
||||
let alignment = eval_enum!("align", output, state, frags.next(), arg0, Origin {
|
||||
"c" => C, "n" => N, "s" => S, "e" => E, "w" => W, "x" => X, "y" => Y
|
||||
}
|
||||
).align(
|
||||
thunk(move|output: &mut O|state.interpret(output, &arg0))
|
||||
).draw(output),
|
||||
});
|
||||
let content = thunk(move|output: &mut O|state.interpret(output, &arg0));
|
||||
align(alignment, content).draw(output)
|
||||
},
|
||||
|
||||
Some("exact") => eval_xy!(
|
||||
"exact", expr, head, output, state, frags.next(),
|
||||
|
|
@ -191,11 +192,11 @@ pub fn eval_view_tui <'a, S> (
|
|||
let arg0 = args.head();
|
||||
let tail0 = args.tail();
|
||||
let arg1 = tail0.head();
|
||||
Ok(Some(match frags.next() {
|
||||
match frags.next() {
|
||||
|
||||
Some("text") => {
|
||||
if let Some(src) = args?.src()? {
|
||||
output.show(src)?
|
||||
output.show(src)
|
||||
} else {
|
||||
return Ok(None)
|
||||
}
|
||||
|
|
@ -208,7 +209,7 @@ pub fn eval_view_tui <'a, S> (
|
|||
state.interpret(output, &arg1)?;
|
||||
// FIXME?: don't max out the used area?
|
||||
Ok(output.area().into())
|
||||
})))?
|
||||
})))
|
||||
},
|
||||
|
||||
Some("bg") => {
|
||||
|
|
@ -218,10 +219,10 @@ pub fn eval_view_tui <'a, S> (
|
|||
state.interpret(output, &arg1)?;
|
||||
// FIXME?: don't max out the used area?
|
||||
Ok(output.area().into())
|
||||
})))?
|
||||
})))
|
||||
},
|
||||
|
||||
_ => return Ok(None)
|
||||
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue