Fix artist list scrolling to bottom on click
Restore saved scroll offset into ListState before select() so ratatui preserves the current viewport position instead of scrolling from zero. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -156,6 +156,7 @@ fn render_tree(frame: &mut Frame, area: Rect, state: &mut AppState, colors: &The
|
||||
}
|
||||
|
||||
let mut list_state = ListState::default();
|
||||
*list_state.offset_mut() = state.artists.tree_scroll_offset;
|
||||
if focused {
|
||||
list_state.select(state.artists.selected_index);
|
||||
}
|
||||
@@ -267,6 +268,7 @@ fn render_songs(frame: &mut Frame, area: Rect, state: &mut AppState, colors: &Th
|
||||
}
|
||||
|
||||
let mut list_state = ListState::default();
|
||||
*list_state.offset_mut() = state.artists.song_scroll_offset;
|
||||
if focused {
|
||||
list_state.select(artists.selected_song);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user