diff options
| author | akbash <akbash@herdr.dev> | 2026-09-13 02:20:23 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-13 02:20:23 +0300 |
| commit | 5eafc612674c4ac8f7c938769159a3cfd22e52d4 (patch) | |
| tree | 3eaadedd0cbb6c2ca7ef2ae2da31771e824df124 /src/client/shell/endpoint_sidebar.rs | |
| parent | e3a46f4f89142d929bf35c31aac85e5f374d8dcf (diff) | |
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>
Diffstat (limited to 'src/client/shell/endpoint_sidebar.rs')
| -rw-r--r-- | src/client/shell/endpoint_sidebar.rs | 25 |
1 files changed, 21 insertions, 4 deletions
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::<Vec<_>>(); - 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::<Vec<_>>(); 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)); } } } |
