mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-03-13 11:50:44 +01:00
view* -> understand*
This commit is contained in:
parent
4aef21f60d
commit
236ee6b810
4 changed files with 16 additions and 16 deletions
16
app/tek.rs
16
app/tek.rs
|
|
@ -1,16 +1,14 @@
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
#![feature(adt_const_params,
|
#![feature(
|
||||||
associated_type_defaults,
|
adt_const_params, associated_type_defaults, closure_lifetime_binder,
|
||||||
closure_lifetime_binder,
|
impl_trait_in_assoc_type, trait_alias, type_alias_impl_trait, type_changing_struct_update
|
||||||
if_let_guard,
|
)]
|
||||||
impl_trait_in_assoc_type,
|
|
||||||
trait_alias,
|
|
||||||
type_alias_impl_trait,
|
|
||||||
type_changing_struct_update)]
|
|
||||||
mod tek_struct; pub use self::tek_struct::*;
|
mod tek_struct; pub use self::tek_struct::*;
|
||||||
mod tek_trait; pub use self::tek_trait::*;
|
mod tek_trait; pub use self::tek_trait::*;
|
||||||
mod tek_type; pub use self::tek_type::*;
|
mod tek_type; pub use self::tek_type::*;
|
||||||
mod tek_impls;
|
mod tek_impls;
|
||||||
|
|
||||||
extern crate xdg;
|
extern crate xdg;
|
||||||
pub(crate) use ::xdg::BaseDirectories;
|
pub(crate) use ::xdg::BaseDirectories;
|
||||||
pub extern crate atomic_float;
|
pub extern crate atomic_float;
|
||||||
|
|
@ -133,12 +131,14 @@ pub(crate) fn load_view (views: &Views, name: &impl AsRef<str>, body: &impl Lang
|
||||||
views.write().unwrap().insert(name.as_ref().into(), body.src()?.unwrap_or_default().into());
|
views.write().unwrap().insert(name.as_ref().into(), body.src()?.unwrap_or_default().into());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn load_mode (modes: &Modes, name: &impl AsRef<str>, body: &impl Language) -> Usually<()> {
|
pub(crate) fn load_mode (modes: &Modes, name: &impl AsRef<str>, body: &impl Language) -> Usually<()> {
|
||||||
let mut mode = Mode::default();
|
let mut mode = Mode::default();
|
||||||
body.each(|item|mode.add(item))?;
|
body.each(|item|mode.add(item))?;
|
||||||
modes.write().unwrap().insert(name.as_ref().into(), Arc::new(mode));
|
modes.write().unwrap().insert(name.as_ref().into(), Arc::new(mode));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn load_bind (binds: &Binds, name: &impl AsRef<str>, body: &impl Language) -> Usually<()> {
|
pub(crate) fn load_bind (binds: &Binds, name: &impl AsRef<str>, body: &impl Language) -> Usually<()> {
|
||||||
binds.write().unwrap().insert(name.as_ref().into(), Bind::load(body)?);
|
binds.write().unwrap().insert(name.as_ref().into(), Bind::load(body)?);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -3362,16 +3362,16 @@ impl<T: MaybeHas<Track>> HasTrack for T {
|
||||||
|
|
||||||
impl Understand<TuiOut, ()> for App {
|
impl Understand<TuiOut, ()> for App {
|
||||||
|
|
||||||
fn view_expr <'a> (&'a self, to: &mut TuiOut, expr: &'a impl Expression) -> Usually<()> {
|
fn understand_expr <'a> (&'a self, to: &mut TuiOut, expr: &'a impl Expression) -> Usually<()> {
|
||||||
if evaluate_output_expression(self, to, expr)?
|
if evaluate_output_expression(self, to, expr)?
|
||||||
|| evaluate_output_expression_tui(self, to, expr)? {
|
|| evaluate_output_expression_tui(self, to, expr)? {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(format!("App::view_expr: unexpected: {expr:?}").into())
|
Err(format!("App::understand_expr: unexpected: {expr:?}").into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view_word <'a> (&'a self, to: &mut TuiOut, dsl: &'a impl Expression) -> Usually<()> {
|
fn understand_word <'a> (&'a self, to: &mut TuiOut, dsl: &'a impl Expression) -> Usually<()> {
|
||||||
let mut frags = dsl.src()?.unwrap().split("/");
|
let mut frags = dsl.src()?.unwrap().split("/");
|
||||||
match frags.next() {
|
match frags.next() {
|
||||||
Some(":logo") => to.place(&view_logo()),
|
Some(":logo") => to.place(&view_logo()),
|
||||||
|
|
@ -3412,7 +3412,7 @@ impl Understand<TuiOut, ()> for App {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}),
|
}),
|
||||||
_ => unimplemented!("App::view_word: {dsl:?} ({frags:?})"),
|
_ => unimplemented!("App::understand_word: {dsl:?} ({frags:?})"),
|
||||||
},
|
},
|
||||||
Some(":templates") => to.place(&{
|
Some(":templates") => to.place(&{
|
||||||
let modes = self.config.modes.clone();
|
let modes = self.config.modes.clone();
|
||||||
|
|
@ -3466,7 +3466,7 @@ impl Understand<TuiOut, ()> for App {
|
||||||
if let Some(dsl) = views.get(dsl.src()?.unwrap()) {
|
if let Some(dsl) = views.get(dsl.src()?.unwrap()) {
|
||||||
let dsl = dsl.clone();
|
let dsl = dsl.clone();
|
||||||
std::mem::drop(views);
|
std::mem::drop(views);
|
||||||
self.view(to, &dsl)?
|
self.understand(to, &dsl)?
|
||||||
} else {
|
} else {
|
||||||
unimplemented!("{dsl:?}");
|
unimplemented!("{dsl:?}");
|
||||||
}
|
}
|
||||||
|
|
@ -3815,7 +3815,7 @@ mod draw {
|
||||||
to.place_at(to.area(), e);
|
to.place_at(to.area(), e);
|
||||||
}
|
}
|
||||||
for (_index, dsl) in self.mode.view.iter().enumerate() {
|
for (_index, dsl) in self.mode.view.iter().enumerate() {
|
||||||
if let Err(e) = self.view(to, dsl) {
|
if let Err(e) = self.understand(to, dsl) {
|
||||||
*self.error.write().unwrap() = Some(format!("{e}").into());
|
*self.error.write().unwrap() = Some(format!("{e}").into());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
dizzle
2
dizzle
|
|
@ -1 +1 @@
|
||||||
Subproject commit f6fb8c844a31b35f5739297272250ff9c7fee345
|
Subproject commit eec89565c99eb23c2c46803de1bfaabbb6ef95b2
|
||||||
2
tengri
2
tengri
|
|
@ -1 +1 @@
|
||||||
Subproject commit b294f2e62b970cf4e1cb133346132a0a113af575
|
Subproject commit 006cddcc16868aa626ecca6abf1c0f00523402fc
|
||||||
Loading…
Add table
Add a link
Reference in a new issue