aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/sidebar.rs23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/ui/sidebar.rs b/src/ui/sidebar.rs
index 0a2b64ce..395bb2c3 100644
--- a/src/ui/sidebar.rs
+++ b/src/ui/sidebar.rs
@@ -230,15 +230,8 @@ fn workspace_row_height_in_body(
workspace_row_height(app, workspace, indented).min(body_height)
}
-fn workspace_entry_gap(
- app: &AppState,
- entries: &[WorkspaceListEntry],
- entry_idx: usize,
- indented: bool,
-) -> u16 {
- if entry_idx + 1 < entries.len()
- && !(indented && next_entry_is_indented_workspace(entries, entry_idx))
- {
+fn workspace_entry_gap(app: &AppState, entries: &[WorkspaceListEntry], entry_idx: usize) -> u16 {
+ if entry_idx + 1 < entries.len() && !next_entry_is_indented_workspace(entries, entry_idx) {
app.sidebar_spaces.row_gap
} else {
0
@@ -476,7 +469,7 @@ fn workspace_list_visible_count(app: &AppState, area: Rect, scroll: usize) -> us
};
(
workspace_row_height_in_body(app, ws, *indented, body.height),
- workspace_entry_gap(app, &entries, entry_idx, *indented),
+ workspace_entry_gap(app, &entries, entry_idx),
)
}
};
@@ -500,7 +493,7 @@ fn workspace_list_bottom_start(app: &AppState, area: Rect) -> usize {
let Some(workspace) = app.workspaces.get(*ws_idx) else {
continue;
};
- let gap = workspace_entry_gap(app, &entries, entry_idx, *indented);
+ let gap = workspace_entry_gap(app, &entries, entry_idx);
let needed = workspace_row_height_in_body(app, workspace, *indented, body.height)
.saturating_add(gap);
if used_rows.saturating_add(needed) > body.height {
@@ -691,7 +684,7 @@ pub(crate) fn compute_workspace_list_areas(
continue;
};
let row_height = workspace_row_height_in_body(app, ws, *indented, body.height);
- let gap = workspace_entry_gap(app, &entries, entry_idx, *indented);
+ let gap = workspace_entry_gap(app, &entries, entry_idx);
if row_y.saturating_add(row_height) > body_bottom {
break;
}
@@ -2488,7 +2481,7 @@ rows = [[{ token = "git_status", fg = "#123456" }]]
assert!(!cards[0].indented);
assert_eq!(cards[1].ws_idx, 1);
assert!(cards[1].indented);
- assert_eq!(cards[1].rect.y, cards[0].rect.y + cards[0].rect.height + 1);
+ assert_eq!(cards[1].rect.y, cards[0].rect.y + cards[0].rect.height);
}
#[test]
@@ -2506,7 +2499,7 @@ rows = [[{ token = "git_status", fg = "#123456" }]]
let (spacious, _) = compute_workspace_list_areas(&app, Rect::new(0, 0, 30, 30));
assert_eq!(
spacious[1].rect.y,
- spacious[0].rect.y + spacious[0].rect.height + 2
+ spacious[0].rect.y + spacious[0].rect.height
);
assert_eq!(
spacious[2].rect.y,
@@ -2517,7 +2510,7 @@ rows = [[{ token = "git_status", fg = "#123456" }]]
spacious[2].rect.y + spacious[2].rect.height + 2
);
let spacious_metrics = workspace_list_scroll_metrics(&app, Rect::new(0, 0, 30, 7));
- assert_eq!(spacious_metrics.viewport_rows, 2);
+ assert_eq!(spacious_metrics.viewport_rows, 3);
assert_eq!(spacious_metrics.max_offset_from_bottom, 2);
app.sidebar_spaces.row_gap = 0;