From bc0464ef03281a030240b63cb2f21ff8b249444c Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 17 Feb 2026 15:23:11 -0600 Subject: [PATCH] trying to fix the scrolling in the verse editors --- src/ui/song_editor.rs | 8 ++++++++ src/ui/widgets/verse_editor.rs | 32 +++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/ui/song_editor.rs b/src/ui/song_editor.rs index 8e79d0d..46c68d0 100644 --- a/src/ui/song_editor.rs +++ b/src/ui/song_editor.rs @@ -632,6 +632,14 @@ impl SongEditor { }, )); } + verse_editor::Action::ScrollVerses( + pixels, + ) => { + // + // + // + () + } verse_editor::Action::UpdateVerseName( verse_name, ) => { diff --git a/src/ui/widgets/verse_editor.rs b/src/ui/widgets/verse_editor.rs index aa97227..943a414 100644 --- a/src/ui/widgets/verse_editor.rs +++ b/src/ui/widgets/verse_editor.rs @@ -35,6 +35,7 @@ pub enum Action { UpdateVerse((VerseName, String)), UpdateVerseName(String), DeleteVerse(VerseName), + ScrollVerses(f32), None, } @@ -53,18 +54,27 @@ impl VerseEditor { } pub fn update(&mut self, message: Message) -> Action { match message { - Message::UpdateLyric(action) => { - self.content.perform(action.clone()); - match action { - text_editor::Action::Edit(_edit) => { - let lyrics = self.content.text(); - self.lyric.clone_from(&lyrics); - let verse = self.verse_name; - Action::UpdateVerse((verse, lyrics)) - } - _ => Action::None, + Message::UpdateLyric(action) => match action { + text_editor::Action::Edit(ref _edit) => { + self.content.perform(action.clone()); + let lyrics = self.content.text(); + self.lyric.clone_from(&lyrics); + let verse = self.verse_name; + Action::UpdateVerse((verse, lyrics)) } - } + text_editor::Action::Scroll { pixels } => { + if self.content.line_count() > 6 { + self.content.perform(action.clone()); + Action::None + } else { + Action::ScrollVerses(pixels) + } + } + _ => { + self.content.perform(action.clone()); + Action::None + } + }, Message::UpdateVerseName(verse_name) => { Action::UpdateVerseName(verse_name) }