aboutsummaryrefslogtreecommitdiff
path: root/src/client/shell/sidebar.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-03 02:47:48 +0300
committerGitHub <noreply@github.com>2026-09-03 02:47:48 +0300
commit94f6d9c0d9bb9cf9ffae99d8bbfb09e9bf2fc9e0 (patch)
treee4dfc7ea631cbb872ffc59a7ca0270a8fe000d7d /src/client/shell/sidebar.rs
parent2ae8b91ca5919c26df7ce779b0e9a5dd98b769ae (diff)
fix: reveal newly focused spaces in the sidebar (#3554)
Diffstat (limited to 'src/client/shell/sidebar.rs')
-rw-r--r--src/client/shell/sidebar.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/client/shell/sidebar.rs b/src/client/shell/sidebar.rs
index f8a87043..2a71e297 100644
--- a/src/client/shell/sidebar.rs
+++ b/src/client/shell/sidebar.rs
@@ -246,12 +246,32 @@ pub(crate) fn render_sidebar(
.map_or(0, |next| u16::from(!next.indented) * config.spaces.row_gap)
})
.collect::<Vec<_>>();
- let metrics = super::scroll::list_scroll_metrics(
+ let mut metrics = super::scroll::list_scroll_metrics(
&row_heights,
&gaps,
body.height,
*state.workspace_scroll,
);
+ if !body.is_empty() && std::mem::take(state.reveal_focused_workspace) {
+ if let Some(target) = entries
+ .iter()
+ .position(|entry| snapshot.workspaces[entry.index].focused)
+ {
+ *state.workspace_scroll = super::scroll::list_scroll_start_to_reveal(
+ &row_heights,
+ &gaps,
+ body.height,
+ *state.workspace_scroll,
+ target,
+ );
+ metrics = super::scroll::list_scroll_metrics(
+ &row_heights,
+ &gaps,
+ body.height,
+ *state.workspace_scroll,
+ );
+ }
+ }
hits.workspace_max_scroll = metrics.max_offset_from_bottom;
hits.workspace_scroll_metrics = Some(metrics);
*state.workspace_scroll = metrics