feat(layout): reduce default MAM_MIN_PANE_COLS to 40 for single workspace 2xK multi-pane tiling
This commit is contained in:
@@ -864,5 +864,91 @@ def test_lib_sh_new_session_passes_mam_ws_label(mam_sandbox):
|
||||
assert '_real_herdr workspace rename "$existing_ws" "$MAM_WS_LABEL"' in content
|
||||
|
||||
|
||||
# ==============================================================================
|
||||
# FEATURE: 2xK Grid Layout Engine (min_cols=40 & multi-pane workspace tiling)
|
||||
# ==============================================================================
|
||||
|
||||
def test_layout_default_min_cols_40_in_tier1():
|
||||
"""Verify default min_cols=40 behavior across compute_2xk_layout in Tier 1 suite."""
|
||||
from lib_py.layout import compute_2xk_layout
|
||||
|
||||
# 1. 2 panes in 80 col width (80 // 2 = 40 == min_cols 40) -> splits right cleanly
|
||||
payload_80 = {
|
||||
"result": {
|
||||
"panes": [
|
||||
{"pane_id": "p1", "rect": {"x": 0, "y": 0, "width": 80, "height": 40}},
|
||||
{"pane_id": "p2", "rect": {"x": 0, "y": 40, "width": 80, "height": 40}}
|
||||
]
|
||||
}
|
||||
}
|
||||
decision = compute_2xk_layout(payload_80)
|
||||
assert decision.direction == "right"
|
||||
assert not decision.is_overflow
|
||||
assert decision.reason == "new_column_right"
|
||||
|
||||
# 2. 2 panes in 79 col width (79 // 2 = 39 < min_cols 40) -> column_width_overflow
|
||||
payload_79 = {
|
||||
"result": {
|
||||
"panes": [
|
||||
{"pane_id": "p1", "rect": {"x": 0, "y": 0, "width": 79, "height": 40}},
|
||||
{"pane_id": "p2", "rect": {"x": 0, "y": 40, "width": 79, "height": 40}}
|
||||
]
|
||||
}
|
||||
}
|
||||
decision_overflow = compute_2xk_layout(payload_79)
|
||||
assert decision_overflow.direction == "overflow"
|
||||
assert decision_overflow.is_overflow
|
||||
assert decision_overflow.reason == "column_width_overflow"
|
||||
|
||||
|
||||
def test_layout_single_workspace_90_100_cols_tiling_tier1():
|
||||
"""Verify 3-4 agents tiling in standard 90-100 col terminal windows within a single workspace."""
|
||||
from lib_py.layout import compute_2xk_layout
|
||||
|
||||
for total_w in [90, 100]:
|
||||
half_w = total_w // 2
|
||||
|
||||
# Step 1: 1 pane -> 2 panes (split down)
|
||||
p1 = {"result": {"panes": [{"pane_id": "p1", "rect": {"x": 0, "y": 0, "width": total_w, "height": 40}}]}}
|
||||
d1 = compute_2xk_layout(p1)
|
||||
assert d1.direction == "down"
|
||||
assert d1.target_pane_id == "p1"
|
||||
assert not d1.is_overflow
|
||||
|
||||
# Step 2: 2 panes -> 3 panes (split right to open 2nd column)
|
||||
p2 = {"result": {"panes": [
|
||||
{"pane_id": "p1", "rect": {"x": 0, "y": 0, "width": total_w, "height": 20}},
|
||||
{"pane_id": "p2", "rect": {"x": 0, "y": 20, "width": total_w, "height": 20}}
|
||||
]}}
|
||||
d2 = compute_2xk_layout(p2)
|
||||
assert d2.direction == "right"
|
||||
assert d2.target_pane_id == "p1"
|
||||
assert not d2.is_overflow
|
||||
|
||||
# Step 3: 3 panes -> 4 panes (split singleton 2nd column down)
|
||||
p3 = {"result": {"panes": [
|
||||
{"pane_id": "p1", "rect": {"x": 0, "y": 0, "width": half_w, "height": 20}},
|
||||
{"pane_id": "p2", "rect": {"x": 0, "y": 20, "width": half_w, "height": 20}},
|
||||
{"pane_id": "p3", "rect": {"x": half_w, "y": 0, "width": half_w, "height": 40}}
|
||||
]}}
|
||||
d3 = compute_2xk_layout(p3)
|
||||
assert d3.direction == "down"
|
||||
assert d3.target_pane_id == "p3"
|
||||
assert not d3.is_overflow
|
||||
|
||||
# Step 4: 4 panes (2x2 complete) -> 5th agent overflows to fresh workspace
|
||||
p4 = {"result": {"panes": [
|
||||
{"pane_id": "p1", "rect": {"x": 0, "y": 0, "width": half_w, "height": 20}},
|
||||
{"pane_id": "p2", "rect": {"x": 0, "y": 20, "width": half_w, "height": 20}},
|
||||
{"pane_id": "p3", "rect": {"x": half_w, "y": 0, "width": half_w, "height": 20}},
|
||||
{"pane_id": "p4", "rect": {"x": half_w, "y": 20, "width": half_w, "height": 20}}
|
||||
]}}
|
||||
d4 = compute_2xk_layout(p4)
|
||||
assert d4.direction == "overflow"
|
||||
assert d4.is_overflow
|
||||
assert d4.reason == "column_width_overflow"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user