diff options
| author | akbash <akbash@herdr.dev> | 2026-08-04 00:51:23 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-04 00:51:23 +0300 |
| commit | d78e3d3b51266a1ff80ae6858b894e782aac3e9f (patch) | |
| tree | f7890cf6ff375012c3bb8a8ff0e8ba8f43f0a644 | |
| parent | 35be08cd953e057927c66dc2ad255df459810446 (diff) | |
fix(ui): keep collapsed workspace status visible (#2239)
refs #2216
Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com>
Co-authored-by: Can Celik <ogulcancelik@gmail.com>
| -rw-r--r-- | src/ui/sidebar.rs | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/ui/sidebar.rs b/src/ui/sidebar.rs index d9f6197f..23e9afd4 100644 --- a/src/ui/sidebar.rs +++ b/src/ui/sidebar.rs @@ -808,8 +808,7 @@ pub(super) fn render_sidebar_collapsed(app: &AppState, frame: &mut Frame, area: frame.render_widget( Paragraph::new(Line::from(vec![ - Span::styled(format!("{}", visible_idx + 1), num_style), - Span::styled(" ", row_style), + Span::styled(format!("{:<2}", visible_idx + 1), num_style), Span::styled(icon, icon_style), ])), Rect::new(ws_area.x, y, ws_area.width, 1), @@ -2126,6 +2125,47 @@ rows = [[{ token = "git_status", fg = "#123456" }]] } #[test] + fn collapsed_sidebar_keeps_workspace_status_visible_for_two_digit_positions() { + let mut app = crate::app::state::AppState::test_new(); + app.workspaces = (1..=10) + .map(|idx| Workspace::test_new(&format!("workspace-{idx}"))) + .collect(); + app.ensure_test_terminals(); + + for ws_idx in 0..app.workspaces.len() { + let pane = app.workspaces[ws_idx].tabs[0].root_pane; + let terminal_id = app.workspaces[ws_idx].tabs[0].panes[&pane] + .attached_terminal_id + .clone(); + app.terminals.get_mut(&terminal_id).unwrap().detected_agent = Some(Agent::Claude); + } + + let area = Rect::new(0, 0, 4, 25); + let (workspace_area, _, _) = collapsed_sidebar_sections(area); + let mut terminal = Terminal::new(TestBackend::new(area.width, area.height)) + .expect("test terminal should initialize"); + + terminal + .draw(|frame| render_sidebar_collapsed(&app, frame, area)) + .expect("collapsed sidebar should render"); + + let tenth_row = workspace_area.y + 9; + let buffer = terminal.backend().buffer(); + assert_eq!(buffer[(workspace_area.x, workspace_area.y)].symbol(), "1"); + assert_eq!( + buffer[(workspace_area.x + 1, workspace_area.y)].symbol(), + " " + ); + assert_eq!( + buffer[(workspace_area.x + 2, workspace_area.y)].symbol(), + "·" + ); + assert_eq!(buffer[(workspace_area.x, tenth_row)].symbol(), "1"); + assert_eq!(buffer[(workspace_area.x + 1, tenth_row)].symbol(), "0"); + assert_eq!(buffer[(workspace_area.x + 2, tenth_row)].symbol(), "·"); + } + + #[test] fn collapsed_sidebar_keeps_status_visible_for_two_digit_positions() { let mut app = crate::app::state::AppState::test_new(); app.workspaces = (1..=10) |
