diff options
| author | kangal-bot <kangal@herdr.dev> | 2026-05-27 15:09:31 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-27 15:09:31 +0300 |
| commit | 858c36974bad616e9e6c1897882b8c9a97396bec (patch) | |
| tree | 63a6b332599596708dc7a66cead14af474755fd2 /src/ui.rs | |
| parent | 9a89e3dc181bdf35101c2066bea114394afb93e2 (diff) | |
feat: configure mobile width threshold (#317)
Diffstat (limited to 'src/ui.rs')
| -rw-r--r-- | src/ui.rs | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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")]; |
