diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-06 02:27:06 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-06 02:27:06 +0300 |
| commit | 9e9bc8a144667a6b7debfd4f0c7a31ff0e11493a (patch) | |
| tree | 03f1259f91fd9edeacfd4b904f2e84d4acf25232 /src/client/shell/sidebar.rs | |
| parent | 35b0dff96579f099e0436290085024424ffb289c (diff) | |
feat: manage multiple ssh machines from one client (#3670)
Diffstat (limited to 'src/client/shell/sidebar.rs')
| -rw-r--r-- | src/client/shell/sidebar.rs | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/client/shell/sidebar.rs b/src/client/shell/sidebar.rs index 2a71e297..0aaa0d51 100644 --- a/src/client/shell/sidebar.rs +++ b/src/client/shell/sidebar.rs @@ -4,7 +4,9 @@ use ratatui::{ widgets::{Paragraph, Widget}, }; -fn collapsed_sidebar_sections(area: Rect) -> (Rect, Option<u16>, Rect) { +pub(in crate::client::shell) fn collapsed_sidebar_sections( + area: Rect, +) -> (Rect, Option<u16>, Rect) { let content = Rect::new(area.x, area.y, area.width.saturating_sub(1), area.height); if content.is_empty() { return (Rect::default(), None, Rect::default()); @@ -85,6 +87,7 @@ pub(crate) fn render_collapsed_sidebar( ); hits.workspaces.push(WorkspaceHit { rect, + endpoint_id: ClientEndpointId::Local, workspace_id: workspace.workspace_id.clone(), indented: false, group_toggle: None, @@ -308,6 +311,7 @@ pub(crate) fn render_sidebar( config.status_indicators, entry, rows, + true, selected, dragged, palette, @@ -330,6 +334,7 @@ pub(crate) fn render_sidebar( }); hits.workspaces.push(WorkspaceHit { rect, + endpoint_id: ClientEndpointId::Local, workspace_id: workspace.workspace_id.clone(), indented: entry.indented, group_toggle, @@ -440,17 +445,6 @@ pub(crate) fn render_sidebar( ); } -pub(crate) fn render_sidebar_background(buffer: &mut Buffer, area: Rect, palette: &Palette) { - buffer.set_style(area, Style::default().bg(palette.sidebar_bg)); - let separator_x = area.right().saturating_sub(1); - for y in area.y..area.bottom() { - if let Some(cell) = buffer.cell_mut((separator_x, y)) { - cell.set_symbol("│"); - cell.set_style(Style::default().fg(palette.surface_dim)); - } - } -} - pub(crate) fn workspace_entries( snapshot: &ClientShellSnapshot, collapsed_groups: &HashSet<String>, @@ -540,7 +534,7 @@ pub(crate) fn workspace_entries( entries } -fn parent_group_key(snapshot: &ClientShellSnapshot, index: usize) -> Option<String> { +pub(super) fn parent_group_key(snapshot: &ClientShellSnapshot, index: usize) -> Option<String> { let workspace = snapshot.workspaces.get(index)?; let worktree = workspace.worktree.as_ref()?; if worktree.is_linked_worktree { @@ -560,7 +554,7 @@ fn parent_group_key(snapshot: &ClientShellSnapshot, index: usize) -> Option<Stri .then(|| worktree.key.clone()) } -fn displayed_workspace_status( +pub(super) fn displayed_workspace_status( snapshot: &ClientShellSnapshot, workspace: &ClientShellWorkspace, collapsed_groups: &HashSet<String>, @@ -589,7 +583,7 @@ fn displayed_workspace_status( .unwrap_or(workspace.agent_status) } -fn workspace_rows( +pub(in crate::client::shell) fn workspace_rows( workspace: &ClientShellWorkspace, status: crate::api::schema::AgentStatus, indented: bool, @@ -618,7 +612,7 @@ fn workspace_rows( ) } -fn render_workspace_rows( +pub(in crate::client::shell) fn render_workspace_rows( buffer: &mut Buffer, area: Rect, workspace: &ClientShellWorkspace, @@ -626,6 +620,7 @@ fn render_workspace_rows( indicators: crate::config::StatusIndicatorStyle, entry: &WorkspaceEntry, rows: Vec<Vec<crate::ui::ResolvedToken>>, + endpoint_active: bool, selected: bool, dragged: bool, palette: &Palette, @@ -661,7 +656,7 @@ fn render_workspace_rows( } else { x = x.saturating_add(3); } - let highlighted = workspace.focused || dragged; + let highlighted = endpoint_active && workspace.focused || dragged; let workspace_style = Style::default() .fg(if highlighted { palette.text @@ -673,7 +668,7 @@ fn render_workspace_rows( } else { Modifier::empty() }); - let secondary_style = Style::default().fg(if workspace.focused { + let secondary_style = Style::default().fg(if endpoint_active && workspace.focused { palette.mauve } else { palette.overlay0 @@ -703,7 +698,7 @@ fn render_workspace_rows( Some(palette.selection_bg) } else if dragged { Some(palette.surface1) - } else if workspace.focused { + } else if endpoint_active && workspace.focused { Some(palette.active_row_bg) } else { None |
