From 5eafc612674c4ac8f7c938769159a3cfd22e52d4 Mon Sep 17 00:00:00 2001 From: akbash Date: Sun, 13 Sep 2026 02:20:23 +0300 Subject: fix: honor space row gaps across machines (#3740) * fix: honor space row gaps across machines refs #3738 * test: cover scrolling with machine space gaps refs #3738 --------- Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> --- src/client/shell/endpoint_sidebar.rs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/client/shell/endpoint_sidebar.rs') diff --git a/src/client/shell/endpoint_sidebar.rs b/src/client/shell/endpoint_sidebar.rs index 193d75d1..bce484a3 100644 --- a/src/client/shell/endpoint_sidebar.rs +++ b/src/client/shell/endpoint_sidebar.rs @@ -314,7 +314,20 @@ pub(super) fn render_expanded( } }) .collect::>(); - let gaps = vec![0; rows.len()]; + let gaps = rows + .iter() + .enumerate() + .map(|(index, row)| match (row, rows.get(index + 1)) { + ( + Row::Workspace { endpoint, .. }, + Some(Row::Workspace { + endpoint: next_endpoint, + entry, + }), + ) if endpoint == next_endpoint => u16::from(!entry.indented) * config.spaces.row_gap, + _ => 0, + }) + .collect::>(); if std::mem::take(state.reveal_navigation_workspace) { let selected_row = rows.iter().position(|row| match row { Row::Workspace { endpoint, entry } => { @@ -355,7 +368,7 @@ pub(super) fn render_expanded( let show_scrollbar = metrics.max_offset_from_bottom > 0 && body.width > 1; let content_width = body.width.saturating_sub(u16::from(show_scrollbar)); let mut y = body.y; - for row in rows.iter().skip(*state.workspace_scroll) { + for (row_index, row) in rows.iter().enumerate().skip(*state.workspace_scroll) { match row { Row::Endpoint(index) => { if y >= body.bottom() { @@ -383,7 +396,9 @@ pub(super) fn render_expanded( ), endpoint_id: endpoint.endpoint_id.clone(), }); - y = y.saturating_add(1); + y = y + .saturating_add(1) + .saturating_add(gaps.get(row_index).copied().unwrap_or(0)); } Row::Workspace { endpoint, entry } => { let endpoint = &state.endpoints[*endpoint]; @@ -460,7 +475,9 @@ pub(super) fn render_expanded( indented: entry.indented, group_toggle, }); - y = y.saturating_add(height); + y = y + .saturating_add(height) + .saturating_add(gaps.get(row_index).copied().unwrap_or(0)); } } } -- cgit v1.2.3