Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ pub struct AppState {
pub toast: Option<Toast>,
pub icon_mode: IconMode,
pub github_token: Option<String>,
pub terminal_height: u16,
pub download_path: Option<String>,
pub full_tree: Option<Vec<RepoItem>>,
pub folder_sizes: HashMap<String, u64>,
Expand Down Expand Up @@ -155,6 +156,7 @@ impl AppState {
toast: None,
icon_mode: IconMode::Emoji,
github_token: None,
terminal_height: 24,
download_path: None,
full_tree: None,
folder_sizes: HashMap::new(),
Expand Down Expand Up @@ -207,7 +209,16 @@ impl AppState {
}

fn adjust_scroll(&mut self) {
let visible_height = 10;
// Base chrome: breadcrumb (3) + file list borders (2) + header row (1) + help bar (2)
let mut chrome_height: u16 = 8;
if self.downloading {
chrome_height += 2; // download status bar
}
if self.is_searching {
chrome_height += 3; // search bar with borders
}
let visible_height = (self.terminal_height.saturating_sub(chrome_height)) as usize;
let visible_height = visible_height.max(1);
if self.cursor < self.scroll_offset {
self.scroll_offset = self.cursor;
} else if self.cursor >= self.scroll_offset + visible_height {
Expand Down Expand Up @@ -488,6 +499,7 @@ async fn event_loop(

terminal.draw(|f| {
let size = f.size();
state_lock.terminal_height = size.height;
f.render_widget(
ratatui::widgets::Block::default()
.style(ratatui::style::Style::default().bg(theme::BG_COLOR)),
Expand Down
Loading