mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-08-07 22:17:07 +02:00
stylistic
This commit is contained in:
parent
33e135c614
commit
8970ae5d5d
1 changed files with 10 additions and 12 deletions
22
src/eval.rs
22
src/eval.rs
|
|
@ -221,7 +221,7 @@ pub fn eval_view <'a, O: Screen + 'a, S> (
|
||||||
/// # Ok(()) }
|
/// # Ok(()) }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn eval_view_tui <'a, S> (
|
pub fn eval_view_tui <'a, S> (
|
||||||
state: &S, output: &mut Tui, expr: impl Expression + 'a
|
state: &S, to: &mut Tui, expr: impl Expression + 'a
|
||||||
) -> Perhaps<XYWH<u16>> where
|
) -> Perhaps<XYWH<u16>> where
|
||||||
S: Interpret<Tui, Option<XYWH<u16>>>
|
S: Interpret<Tui, Option<XYWH<u16>>>
|
||||||
+ for<'b>Namespace<'b, bool>
|
+ for<'b>Namespace<'b, bool>
|
||||||
|
|
@ -239,7 +239,7 @@ pub fn eval_view_tui <'a, S> (
|
||||||
match frags.next() {
|
match frags.next() {
|
||||||
Some("text") => {
|
Some("text") => {
|
||||||
if let Some(src) = args?.src()? {
|
if let Some(src) = args?.src()? {
|
||||||
output.show(src)
|
to.show(src)
|
||||||
} else {
|
} else {
|
||||||
return Ok(None)
|
return Ok(None)
|
||||||
}
|
}
|
||||||
|
|
@ -248,11 +248,10 @@ pub fn eval_view_tui <'a, S> (
|
||||||
Some("fg") => {
|
Some("fg") => {
|
||||||
let arg0 = arg0?.expect("fg: expected arg 0 (color)");
|
let arg0 = arg0?.expect("fg: expected arg 0 (color)");
|
||||||
if let Some(color) = Namespace::namespace(state, arg0)? {
|
if let Some(color) = Namespace::namespace(state, arg0)? {
|
||||||
output.show(fg(color, thunk(move|output: &mut Tui|{
|
fg(color, thunk(move|to: &mut Tui|{
|
||||||
state.interpret(output, &arg1)?;
|
state.interpret(to, &arg1)?;
|
||||||
// FIXME?: don't max out the used area?
|
Ok(Some(to.area().into())) // FIXME?: don't max out the used area?
|
||||||
Ok(Some(output.area().into()))
|
})).draw(to)
|
||||||
})))
|
|
||||||
} else {
|
} else {
|
||||||
return Err(format!("fg: {arg0:?}: not a color").into())
|
return Err(format!("fg: {arg0:?}: not a color").into())
|
||||||
}
|
}
|
||||||
|
|
@ -261,11 +260,10 @@ pub fn eval_view_tui <'a, S> (
|
||||||
Some("bg") => {
|
Some("bg") => {
|
||||||
let arg0 = arg0?.expect("bg: expected arg 0 (color)");
|
let arg0 = arg0?.expect("bg: expected arg 0 (color)");
|
||||||
if let Some(color) = Namespace::namespace(state, arg0)? {
|
if let Some(color) = Namespace::namespace(state, arg0)? {
|
||||||
output.show(bg(color, thunk(move|output: &mut Tui|{
|
bg(color, thunk(move|to: &mut Tui|{
|
||||||
state.interpret(output, &arg1)?;
|
state.interpret(to, &arg1)?;
|
||||||
// FIXME?: don't max out the used area?
|
Ok(Some(to.area().into())) // FIXME?: don't max out the used area?
|
||||||
Ok(Some(output.area().into()))
|
})).draw(to)
|
||||||
})))
|
|
||||||
} else {
|
} else {
|
||||||
return Err(format!("bg: {arg0:?}: not a color").into())
|
return Err(format!("bg: {arg0:?}: not a color").into())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue