show phrase length in list

This commit is contained in:
🪞👃🪞 2024-10-14 11:26:58 +03:00
parent efdc135cae
commit ea88622081
2 changed files with 11 additions and 2 deletions

View file

@ -133,6 +133,12 @@ pub trait Layout<E: Engine>: Widget<Engine = E> + Sized {
fn align_center (self) -> Align<Self> {
Align::Center(self)
}
fn align_w (self) -> Align<Self> {
Align::W(self)
}
fn align_e (self) -> Align<Self> {
Align::E(self)
}
fn align_x (self) -> Align<Self> {
Align::X(self)
}

View file

@ -16,8 +16,11 @@ impl Content for PhrasePool<Tui> {
fn content (&self) -> impl Widget<Engine = Tui> {
let content = col!(
(i, phrase) in self.phrases.iter().enumerate() => Layers::new(|add|{
let Phrase { ref name, color, .. } = *phrase.read().unwrap();
let row1 = format!(" {i}");
let Phrase { ref name, color, length, .. } = *phrase.read().unwrap();
let row1 = lay!(
format!(" {i}").align_w().fill_x(),
format!("{length} ").align_e().fill_x(),
).fill_x();
let row2 = if let Some(PhrasePoolMode::Rename(phrase, _)) = self.mode {
if self.focused && i == phrase {
format!(" {}", name)