mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
auto select new phrase; add corners
This commit is contained in:
parent
96ca1e148b
commit
bfe51cecdf
1 changed files with 12 additions and 6 deletions
|
|
@ -47,10 +47,14 @@ impl Content for PhrasePool<Tui> {
|
||||||
col!(
|
col!(
|
||||||
"Phrases:".fill_x().fixed_y(2),
|
"Phrases:".fill_x().fixed_y(2),
|
||||||
col!((i, phrase) in self.phrases.iter().enumerate() =>
|
col!((i, phrase) in self.phrases.iter().enumerate() =>
|
||||||
format!("{i}").fixed_y(2).bg(if i == self.phrase {
|
Layers::new(|add|{
|
||||||
Color::Rgb(40, 50, 30)
|
add(&format!(" {i}").fixed_y(2).bg(if i == self.phrase {
|
||||||
} else {
|
Color::Rgb(40, 50, 30)
|
||||||
Color::Rgb(28, 35, 25)
|
} else {
|
||||||
|
Color::Rgb(28, 35, 25)
|
||||||
|
}))?;
|
||||||
|
if self.focused && i == self.phrase { add(&CORNERS)?; }
|
||||||
|
Ok(())
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
.fill_xy()
|
.fill_xy()
|
||||||
|
|
@ -76,10 +80,12 @@ impl Handle<Tui> for PhrasePool<Tui> {
|
||||||
self.phrase = (self.phrase + 1) % self.phrases.len()
|
self.phrase = (self.phrase + 1) % self.phrases.len()
|
||||||
},
|
},
|
||||||
key!(KeyCode::Char('i')) => {
|
key!(KeyCode::Char('i')) => {
|
||||||
self.phrases.insert(self.phrase, Arc::new(RwLock::new(Phrase::default())))
|
self.phrases.insert(self.phrase, Arc::new(RwLock::new(Phrase::default())));
|
||||||
|
self.phrase += 1;
|
||||||
},
|
},
|
||||||
key!(KeyCode::Char('a')) => {
|
key!(KeyCode::Char('a')) => {
|
||||||
self.phrases.push(Arc::new(RwLock::new(Phrase::default())))
|
self.phrases.push(Arc::new(RwLock::new(Phrase::default())));
|
||||||
|
self.phrase = self.phrases.len() - 1;
|
||||||
},
|
},
|
||||||
_ => return Ok(None),
|
_ => return Ok(None),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue