mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
fixed up some parsing and removed some edn mentions
This commit is contained in:
parent
5e7b867aba
commit
452bdf9598
15 changed files with 290 additions and 292 deletions
|
|
@ -20,7 +20,7 @@ handle!(TuiIn: |self: Example, input|{
|
|||
return Ok(None)
|
||||
});
|
||||
enum ExampleCommand { Next, Previous }
|
||||
edn_command!(ExampleCommand: |app: Example| {
|
||||
atom_command!(ExampleCommand: |app: Example| {
|
||||
(":prev" [] Self::Previous)
|
||||
(":next" [] Self::Next)
|
||||
});
|
||||
|
|
@ -51,7 +51,7 @@ view!(TuiOut: |self: Example|{
|
|||
let code = Tui::bg(Color::Rgb(10,60,10),
|
||||
Push::y(2, Align::n(format!("{}", EXAMPLES[self.0]))));
|
||||
let content = Tui::bg(Color::Rgb(10,10,60),
|
||||
EdnView::from_source(self, EXAMPLES[self.0]));
|
||||
AtomView::from_source(self, EXAMPLES[self.0]));
|
||||
self.1.of(Bsp::s(title, Bsp::n(""/*code*/, content)))
|
||||
}; {
|
||||
bool {};
|
||||
|
|
|
|||
|
|
@ -46,16 +46,16 @@ impl TuiIn {
|
|||
})
|
||||
}
|
||||
}
|
||||
impl EdnInput for TuiIn {
|
||||
fn matches_edn (&self, token: &str) -> bool {
|
||||
impl AtomInput for TuiIn {
|
||||
fn matches_atom (&self, token: &str) -> bool {
|
||||
if let Some(event) = KeyMatcher::new(token).build() {
|
||||
&event == self.event()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
fn get_event (item: &EdnItem<impl AsRef<str>>) -> Option<Event> {
|
||||
match item { EdnItem::Sym(s) => KeyMatcher::new(s).build(), _ => None }
|
||||
fn get_event (item: &AtomItem<impl AsRef<str>>) -> Option<Event> {
|
||||
match item { AtomItem::Sym(s) => KeyMatcher::new(s).build(), _ => None }
|
||||
}
|
||||
}
|
||||
struct KeyMatcher {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue