mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-08-28 13:06:56 +02:00
update signatures of layout modifiers
This commit is contained in:
parent
e69d4287e0
commit
41ef62146b
6 changed files with 18 additions and 18 deletions
2
dizzle
2
dizzle
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0a4a1ee8379edabfa7431add76926bb4a03d7f22
|
Subproject commit c00aed72086f23aa21e6f28f9e722af61faf240e
|
||||||
|
|
@ -138,7 +138,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.nth(1)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.nth(1)?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("full/x") | Some("full/w") => Full::W(thunk).draw(to)?,
|
Some("full/x") | Some("full/w") => Full::W(thunk).draw(to)?,
|
||||||
Some("full/y") | Some("full/h") => Full::H(thunk).draw(to)?,
|
Some("full/y") | Some("full/h") => Full::H(thunk).draw(to)?,
|
||||||
|
|
@ -157,7 +157,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("exact/w") => thunk.exact_w(
|
Some("exact/w") => thunk.exact_w(
|
||||||
state.namespace(&expr.nth(1)?)?
|
state.namespace(&expr.nth(1)?)?
|
||||||
|
|
@ -183,7 +183,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("min/w") => thunk.min_w(
|
Some("min/w") => thunk.min_w(
|
||||||
state.namespace(&expr.nth(1)?)?
|
state.namespace(&expr.nth(1)?)?
|
||||||
|
|
@ -209,7 +209,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("max/w") => thunk.max_w(
|
Some("max/w") => thunk.max_w(
|
||||||
state.namespace(&expr.nth(1)?)?
|
state.namespace(&expr.nth(1)?)?
|
||||||
|
|
@ -235,7 +235,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("push/w") => thunk.push_x(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
Some("push/w") => thunk.push_x(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
||||||
Some("push/h") => thunk.push_y(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
Some("push/h") => thunk.push_y(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
||||||
|
|
@ -257,7 +257,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("pull/w") => thunk.pull_x(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
Some("pull/w") => thunk.pull_x(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
||||||
Some("pull/h") => thunk.pull_y(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
Some("pull/h") => thunk.pull_y(state.namespace(&expr.nth(1)?)?).draw(to)?,
|
||||||
|
|
@ -279,7 +279,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.last()?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("pad/w") => thunk.pad_w(
|
Some("pad/w") => thunk.pad_w(
|
||||||
state.namespace(&expr.nth(1)?)?
|
state.namespace(&expr.nth(1)?)?
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ where
|
||||||
+ Namespace<O::Unit>
|
+ Namespace<O::Unit>
|
||||||
+ Namespace<Option<O::Unit>>
|
+ Namespace<Option<O::Unit>>
|
||||||
{
|
{
|
||||||
let thunk = draw(move|screen|ok_flat(expr.nth(1)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.nth(1)?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("align/c") => Align(Some(Azimuth::C), thunk).draw(to)?,
|
Some("align/c") => Align(Some(Azimuth::C), thunk).draw(to)?,
|
||||||
Some("align/x") => Align(Some(Azimuth::X), thunk).draw(to)?,
|
Some("align/x") => Align(Some(Azimuth::X), thunk).draw(to)?,
|
||||||
|
|
@ -157,8 +157,8 @@ fn align <S: Screen> (
|
||||||
}
|
}
|
||||||
|
|
||||||
fn_kw_layout!(kw_split |state, output, expr| {
|
fn_kw_layout!(kw_split |state, output, expr| {
|
||||||
let thunk_a = draw(move|screen|ok_flat(expr.nth(1)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk_a = draw(move|screen|ok_flat(expr.nth(1)?.map(|x|state.interpret(screen, x))));
|
||||||
let thunk_b = draw(move|screen|ok_flat(expr.nth(2)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk_b = draw(move|screen|ok_flat(expr.nth(2)?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(match expr.head()? {
|
Ok(match expr.head()? {
|
||||||
Some("bsp/n") => Split::North.stack(thunk_a, thunk_b).draw(output)?,
|
Some("bsp/n") => Split::North.stack(thunk_a, thunk_b).draw(output)?,
|
||||||
Some("bsp/s") => Split::South.stack(thunk_a, thunk_b).draw(output)?,
|
Some("bsp/s") => Split::South.stack(thunk_a, thunk_b).draw(output)?,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
fn_kw_layout!(kw_when |state, output, expr| {
|
fn_kw_layout!(kw_when |state, output, expr| {
|
||||||
let thunk = draw(move|screen|ok_flat(expr.nth(2)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.nth(2)?.map(|x|state.interpret(screen, x))));
|
||||||
ok_flat(matches!(expr.head()?, Some("when")).then(||{
|
ok_flat(matches!(expr.head()?, Some("when")).then(||{
|
||||||
when(state.namespace(&expr.nth(1)?)?.unwrap(), thunk) .draw(output)
|
when(state.namespace(&expr.nth(1)?)?.unwrap(), thunk).draw(output)
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -19,8 +19,8 @@ pub const fn when <'a, T: Screen> (condition: bool, item: impl Draw<'a, T>) -> i
|
||||||
}
|
}
|
||||||
|
|
||||||
fn_kw_layout!(kw_either |state, output, expr| {
|
fn_kw_layout!(kw_either |state, output, expr| {
|
||||||
let thunk_a = draw(move|screen|ok_flat(expr.nth(2)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk_a = draw(move|screen|ok_flat(expr.nth(2)?.map(|x|state.interpret(screen, x))));
|
||||||
let thunk_b = draw(move|screen|ok_flat(expr.nth(3)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk_b = draw(move|screen|ok_flat(expr.nth(3)?.map(|x|state.interpret(screen, x))));
|
||||||
ok_flat(matches!(expr.head()?, Some("either")).then(||{
|
ok_flat(matches!(expr.head()?, Some("either")).then(||{
|
||||||
either(state.namespace(&expr.nth(1)?)?.unwrap(), thunk_a, thunk_b).draw(output)
|
either(state.namespace(&expr.nth(1)?)?.unwrap(), thunk_a, thunk_b).draw(output)
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ impl TuiKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "lang")]
|
#[cfg(feature = "lang")]
|
||||||
pub fn from_dsl <'a> (dsl: &'a impl Language) -> UsuallyRef<'a, Self> {
|
pub fn from_dsl <'a> (dsl: &impl Language) -> UsuallyRef<'a, Self> {
|
||||||
if let Some(word) = dsl.word()? {
|
if let Some(word) = dsl.word()? {
|
||||||
let word = word.trim();
|
let word = word.trim();
|
||||||
Ok(if word == ":char" {
|
Ok(if word == ":char" {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use crate::*;
|
||||||
use Color::*;
|
use Color::*;
|
||||||
|
|
||||||
fn_kw_layout_tui!(kw_tui_fg |state, output, expr| {
|
fn_kw_layout_tui!(kw_tui_fg |state, output, expr| {
|
||||||
let thunk = draw(move|screen|ok_flat(expr.nth(2)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.nth(2)?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(matches!(expr.head()?, Some("fg")).then(||{
|
Ok(matches!(expr.head()?, Some("fg")).then(||{
|
||||||
if let Some(color) = state.namespace(&expr.nth(1)?.expect("fg: expected arg 0 (color)"))? {
|
if let Some(color) = state.namespace(&expr.nth(1)?.expect("fg: expected arg 0 (color)"))? {
|
||||||
fg(color, thunk).draw(output)
|
fg(color, thunk).draw(output)
|
||||||
|
|
@ -13,7 +13,7 @@ fn_kw_layout_tui!(kw_tui_fg |state, output, expr| {
|
||||||
});
|
});
|
||||||
|
|
||||||
fn_kw_layout_tui!(kw_tui_bg |state, output, expr| {
|
fn_kw_layout_tui!(kw_tui_bg |state, output, expr| {
|
||||||
let thunk = draw(move|screen|ok_flat(expr.nth(2)?.map(|x: &'a str|state.interpret(screen, x))));
|
let thunk = draw(move|screen|ok_flat(expr.nth(2)?.map(|x|state.interpret(screen, x))));
|
||||||
Ok(matches!(expr.head()?, Some("bg")).then(||{
|
Ok(matches!(expr.head()?, Some("bg")).then(||{
|
||||||
if let Some(color) = state.namespace(&expr.nth(1)?.expect("bg: expected arg 0 (color)"))? {
|
if let Some(color) = state.namespace(&expr.nth(1)?.expect("bg: expected arg 0 (color)"))? {
|
||||||
bg(color, thunk).draw(output)
|
bg(color, thunk).draw(output)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue