refactor: merge using claude sonnet

This commit is contained in:
Edward Langley
2026-04-01 00:25:19 -07:00
parent d915908354
commit 8c84256ebc

View File

@ -317,8 +317,7 @@ fn draw_title(f: &mut Frame, area: Rect, app: &App) {
let file = app.file_path.as_ref().and_then(|p| p.file_name()).and_then(|n| n.to_str()).map(|n| format!(" ({n})")).unwrap_or_default();
let title = format!(" improvise · {}{}{} ", app.model.name, file, dirty);
let right = " ?:help :q quit ";
let pad = " ".repeat((area.width as usize).saturating_sub(title.len() + right.len()));
let line = format!("{title}{pad}{right}");
let line = fill_line(title, right, area.width);
f.render_widget(Paragraph::new(line).style(Style::default().fg(Color::Black).bg(Color::Blue).add_modifier(Modifier::BOLD)), area);
}
@ -368,9 +367,7 @@ fn draw_status(f: &mut Frame, area: Rect, app: &App) {
let yank_indicator = if app.yanked.is_some() { " [yank]" } else { "" };
let view_badge = format!(" {}{} ", app.model.active_view, yank_indicator);
let left = format!(" {mode_badge}{search_part} {msg}");
let right = view_badge;
let pad = " ".repeat((area.width as usize).saturating_sub(left.len() + right.len()));
let line = format!("{left}{pad}{right}");
let line = fill_line(left, &view_badge, area.width);
let badge_style = mode_style(&app.mode);
f.render_widget(Paragraph::new(line).style(badge_style), area);
}
@ -380,11 +377,7 @@ fn draw_command_bar(f: &mut Frame, area: Rect, buffer: &str) {
}
fn draw_export_prompt(f: &mut Frame, app: &App) {
let area = f.area();
let popup_w = 64u16.min(area.width);
let x = area.x + area.width.saturating_sub(popup_w) / 2;
let y = area.y + area.height / 2;
let popup_area = Rect::new(x, y, popup_w, 3);
let popup_area = centered_popup(f.area(), 64, 3);
f.render_widget(Clear, popup_area);
let block = Block::default().borders(Borders::ALL).border_style(Style::default().fg(Color::Yellow)).title(" Export CSV — path (Esc cancel) ");
@ -395,11 +388,7 @@ fn draw_export_prompt(f: &mut Frame, app: &App) {
}
fn draw_welcome(f: &mut Frame, area: Rect) {
let w = 58u16.min(area.width.saturating_sub(4));
let h = 20u16.min(area.height.saturating_sub(2));
let x = area.x + area.width.saturating_sub(w) / 2;
let y = area.y + area.height.saturating_sub(h) / 2;
let popup = Rect::new(x, y, w, h);
let popup = centered_popup(area, 58, 20);
f.render_widget(Clear, popup);
@ -465,4 +454,15 @@ fn mode_style(mode: &AppMode) -> Style {
}
}
fn fill_line(left: String, right: &str, width: u16) -> String {
let pad = " ".repeat((width as usize).saturating_sub(left.len() + right.len()));
format!("{left}{pad}{right}")
}
fn centered_popup(area: Rect, width: u16, height: u16) -> Rect {
let w = width.min(area.width);
let h = height.min(area.height);
let x = area.x + area.width.saturating_sub(w) / 2;
let y = area.y + area.height.saturating_sub(h) / 2;
Rect::new(x, y, w, h)
}