@@ -662,6 +662,7 @@ impl App {
662662
663663 self . note_input . clear ( ) ;
664664 self . notes . clear ( ) ;
665+ self . editor_description_scroll = 0 ;
665666 self . notes_session_id = self . notes_session_id . wrapping_add ( 1 ) ;
666667 self . note_submit_pending = None ;
667668 self . notes_issue_iid = Some ( iid) ;
@@ -865,7 +866,7 @@ impl App {
865866 pub fn scroll_editor_description ( & mut self , delta : i16 ) {
866867 if !matches ! (
867868 self . overlay,
868- Some ( Overlay :: Details | Overlay :: EditIssue | Overlay :: NewIssue )
869+ Some ( Overlay :: Details | Overlay :: EditIssue | Overlay :: NewIssue | Overlay :: Notes )
869870 ) {
870871 return ;
871872 }
@@ -881,6 +882,12 @@ impl App {
881882 }
882883
883884 fn editor_description_scroll_max ( & self ) -> usize {
885+ if self . overlay == Some ( Overlay :: Notes ) {
886+ let notes_lines = self . notes . len ( ) . clamp ( 1 , 5 ) ;
887+ let input_lines = self . note_input . lines ( ) . count ( ) . max ( 1 ) ;
888+ return ( notes_lines + input_lines + 6 ) . saturating_sub ( 1 ) ;
889+ }
890+
884891 // The read-only details view always renders the markdown preview.
885892 let preview = self . editor_preview || self . overlay == Some ( Overlay :: Details ) ;
886893 crate :: ui:: markdown:: description_lines (
@@ -936,7 +943,13 @@ impl App {
936943 if self . overlay != Some ( Overlay :: GenerateStories ) {
937944 return ;
938945 }
939- let max_scroll = self . story_source . lines ( ) . count ( ) . saturating_sub ( 1 ) ;
946+ let max_scroll = if self . story_preview {
947+ crate :: ui:: markdown:: markdown_preview_lines ( & self . story_source )
948+ . len ( )
949+ . saturating_sub ( 1 )
950+ } else {
951+ self . story_source . lines ( ) . count ( ) . saturating_sub ( 1 )
952+ } ;
940953 if delta > 0 {
941954 self . story_source_scroll = ( self . story_source_scroll + delta as usize ) . min ( max_scroll) ;
942955 } else {
@@ -1271,6 +1284,39 @@ impl App {
12711284 self . story_selected = self . story_selected . saturating_sub ( 1 ) ;
12721285 }
12731286
1287+ pub fn scroll_palette ( & mut self , delta : i16 ) {
1288+ if self . overlay != Some ( Overlay :: Palette ) {
1289+ return ;
1290+ }
1291+ let len = self . commands ( ) . len ( ) ;
1292+ if len == 0 {
1293+ return ;
1294+ }
1295+ if delta > 0 {
1296+ self . palette_selected = ( self . palette_selected + delta as usize ) . min ( len - 1 ) ;
1297+ } else {
1298+ self . palette_selected = self
1299+ . palette_selected
1300+ . saturating_sub ( delta. unsigned_abs ( ) as usize ) ;
1301+ }
1302+ }
1303+
1304+ pub fn scroll_settings ( & mut self , delta : i16 ) {
1305+ let Some ( form) = self . settings_form . as_mut ( ) else {
1306+ return ;
1307+ } ;
1308+ if self . overlay != Some ( Overlay :: Settings ) {
1309+ return ;
1310+ }
1311+ for _ in 0 ..delta. unsigned_abs ( ) {
1312+ if delta > 0 {
1313+ form. focus_next ( ) ;
1314+ } else {
1315+ form. focus_prev ( ) ;
1316+ }
1317+ }
1318+ }
1319+
12741320 pub fn toggle_selected_story ( & mut self ) {
12751321 if self . overlay != Some ( Overlay :: GenerateStories )
12761322 || !matches ! (
@@ -1862,12 +1908,32 @@ impl App {
18621908 self . scroll_editor_description ( delta) ;
18631909 return ;
18641910 }
1911+ Some ( Overlay :: Notes ) => {
1912+ self . scroll_editor_description ( delta) ;
1913+ return ;
1914+ }
18651915 Some ( Overlay :: Help ) => {
18661916 self . scroll_help ( delta) ;
18671917 return ;
18681918 }
18691919 Some ( Overlay :: GenerateStories ) => {
1870- self . scroll_story_source ( delta) ;
1920+ if self . story_tab ( ) == StoryTab :: Generated {
1921+ if delta > 0 {
1922+ self . move_story_selection_down ( ) ;
1923+ } else {
1924+ self . move_story_selection_up ( ) ;
1925+ }
1926+ } else {
1927+ self . scroll_story_source ( delta) ;
1928+ }
1929+ return ;
1930+ }
1931+ Some ( Overlay :: Palette ) => {
1932+ self . scroll_palette ( delta) ;
1933+ return ;
1934+ }
1935+ Some ( Overlay :: Settings ) => {
1936+ self . scroll_settings ( delta) ;
18711937 return ;
18721938 }
18731939 _ => { }
0 commit comments