put phrases from pool in arrangement

This commit is contained in:
🪞👃🪞 2024-10-10 10:02:30 +03:00
parent dc3edc86ff
commit 96ca1e148b
4 changed files with 14 additions and 4 deletions

View file

@ -27,7 +27,7 @@ pub struct PhrasePool<E: Engine> {
/// Highlighted phrase
pub phrase: usize,
/// Phrases in the pool
pub phrases: Vec<Arc<RwLock<Option<Phrase>>>>,
pub phrases: Vec<Arc<RwLock<Phrase>>>,
/// Whether this widget is focused
pub focused: bool,
}
@ -126,10 +126,13 @@ impl<E: Engine> PhrasePool<E> {
_engine: Default::default(),
scroll: 0,
phrase: 0,
phrases: vec![Arc::new(RwLock::new(Some(Phrase::default())))],
phrases: vec![Arc::new(RwLock::new(Phrase::default()))],
focused: false
}
}
pub fn phrase (&self) -> &Arc<RwLock<Phrase>> {
&self.phrases[self.phrase]
}
}
impl<E: Engine> PhraseEditor<E> {
pub fn new () -> Self {