aboutsummaryrefslogtreecommitdiff
path: root/src/ui.rs
diff options
context:
space:
mode:
authorkangal-bot <kangal@herdr.dev>2026-05-27 15:09:31 +0300
committerGitHub <noreply@github.com>2026-05-27 15:09:31 +0300
commit858c36974bad616e9e6c1897882b8c9a97396bec (patch)
tree63a6b332599596708dc7a66cead14af474755fd2 /src/ui.rs
parent9a89e3dc181bdf35101c2066bea114394afb93e2 (diff)
feat: configure mobile width threshold (#317)
Diffstat (limited to 'src/ui.rs')
-rw-r--r--src/ui.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/ui.rs b/src/ui.rs
index 7b45c8c4..78c4b2e7 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -170,7 +170,7 @@ fn compute_view_internal(
resize_panes: bool,
cell_size: crate::kitty_graphics::HostCellSize,
) {
- if is_mobile_width(area) {
+ if is_mobile_width(area, app.mobile_width_threshold) {
compute_mobile_view(app, terminal_runtimes, area, resize_panes, cell_size);
return;
}
@@ -544,6 +544,24 @@ mod tests {
}
#[test]
+ fn configured_mobile_width_threshold_controls_layout_switch() {
+ let mut app = crate::app::state::AppState::test_new();
+ app.workspaces = vec![Workspace::test_new("one")];
+ app.active = Some(0);
+ app.selected = 0;
+ app.mode = Mode::Terminal;
+
+ compute_view(&mut app, Rect::new(0, 0, 80, 20));
+ assert_eq!(app.view.layout, ViewLayout::Desktop);
+
+ app.mobile_width_threshold = 90;
+ compute_view(&mut app, Rect::new(0, 0, 80, 20));
+ assert_eq!(app.view.layout, ViewLayout::Mobile);
+ assert_eq!(app.view.mobile_header_rect, Rect::new(0, 0, 80, 2));
+ assert_eq!(app.view.terminal_area, Rect::new(0, 2, 80, 18));
+ }
+
+ #[test]
fn product_announcement_renders_above_config_diagnostic() {
let mut app = crate::app::state::AppState::test_new();
app.workspaces = vec![Workspace::test_new("one")];