diff options
| author | user <user@clank> | 2026-08-13 22:07:45 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-13 22:07:45 +0200 |
| commit | a8ea4e888938e562885b1a0f009f5743939a879b (patch) | |
| tree | 2ae5df21d4919cfe128830376b55dca814418496 | |
| parent | checks: ignore __pycache__ (the up check imports a sibling check) (diff) | |
| download | sl0ppi-a8ea4e888938e562885b1a0f009f5743939a879b.tar.gz sl0ppi-a8ea4e888938e562885b1a0f009f5743939a879b.tar.xz sl0ppi-a8ea4e888938e562885b1a0f009f5743939a879b.zip | |
sl0p: keep a templated tab's purpose, so runtime tabs get a status bar
Clicking the bar's `+` made a tab with no status bar. The button only exposed
it: pressing `n` in TAB mode did the same, in any `sl0ppi up` session.
The chain: a generated layout had no default_tab_template, so a tab created at
runtime had nothing to take a bar from. It had none because
parse_tab_node_with_template read a tab node's name, cwd and focus but never
its `purpose` -- so templating erased the purpose that IS identity here
(`sl0ppi ls` finds project tabs by it), and the CLI worked around that by
inlining the template into every tab instead of emitting it.
Fixed at the root: a templated tab keeps its own purpose, and the CLI emits
`default_tab_template` again. The generated layout also shrinks -- one copy of
the bar's configuration instead of one per tab.
The two properties trade off against each other, so sl0ppi-up-live.py now
asserts both at once: `sl0ppi ls` still sees a tab per project, and every tab
including one created at runtime has exactly one status bar. Confirmed by
reverting each half separately: without the parser fix the tabs lose their
purpose and `ls` shows "alpha —"; without the CLI change the runtime tab has
zero bars, which is the reported bug.
Two measurement traps cost an hour here and are now written down: counting bars
by grepping dump-layout also counts the template and every swap layout ("4 bars
for 3 tabs"), and list-panes stops reporting borderless plugin panes for a tab
once a client has rendered it.
Also in here, from the same session:
- the split button check found buttons by searching for " + " on any row with a
frame glyph, which matches the stack list's "+N more" once two panes sit side
by side, and then reports the product broken. It now requires the frame
corner the button is drawn against.
- the checks killed their sessions but did not delete them, so each run left an
"EXITED - attach to resurrect" entry: 35 had quietly filled the session
picker. They now delete-session by name.
- and the trap that cost the user their running client: I killed a bare
`sl0ppij` because "there are no user sessions on this box". That was a guess,
not evidence, and wrong. A check's processes always carry that run's own
socket dir or `attach sl0ptest-...`; a bare `sl0ppij` with a cwd in the repo
is a human's. Written into the handover next to the `pkill -f` trap, which is
the same mistake in a different costume.
| -rw-r--r-- | cli/src/core/layout.ts | 44 | ||||
| -rw-r--r-- | cli/test/layout.test.ts | 34 | ||||
| -rw-r--r-- | docs/HANDOVER.md | 24 | ||||
| -rw-r--r-- | docs/roadmap.md | 66 | ||||
| -rwxr-xr-x | packaging/checks/plugin-permissions-live.py | 4 | ||||
| -rwxr-xr-x | packaging/checks/sl0ppi-up-live.py | 56 | ||||
| -rwxr-xr-x | packaging/checks/split-button-live.py | 20 | ||||
| -rwxr-xr-x | packaging/checks/status-bar-live.py | 2 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/input/unit/layout_test.rs | 57 | ||||
| -rw-r--r-- | sl0ppij/zellij-utils/src/kdl/kdl_layout_parser.rs | 15 |
10 files changed, 290 insertions, 32 deletions
diff --git a/cli/src/core/layout.ts b/cli/src/core/layout.ts index 6c2319e..0aa8e5c 100644 --- a/cli/src/core/layout.ts +++ b/cli/src/core/layout.ts @@ -161,16 +161,8 @@ function indent(text: string, spaces: number): string { /** * Fold a tab template around a project's panes. * - * We do NOT emit `default_tab_template` into the generated layout, even though - * that is what it is for: a templated tab loses its `purpose=`, because the - * fork hangs a tab's purpose on the tab's root layout and templating replaces - * it. Verified -- with a template every tab came back `purpose=None`, which - * breaks identity outright: `sl0ppi ls` sees no project tabs and `up` would - * cheerfully create a second set. - * - * So we inline instead: take the template body and substitute the project's - * panes for its `children` node. The tab node keeps its own name/purpose/cwd, - * and the status bar comes along. + * Kept for callers that hand a layout STRING to a running session. The session + * layout emits `default_tab_template` instead -- see `sessionLayoutKdl`. */ export function applyTemplate(fragment: string, template: string): string | undefined { const body = template.slice(template.indexOf("{") + 1, template.lastIndexOf("}")); @@ -219,17 +211,41 @@ function preamble(paneTemplates?: string[]): string { return `${paneTemplates.map((template) => indent(template, 4)).join("\n")}\n`; } -/** A whole-session layout: what `up` passes to `--layout` when creating. */ +/** + * A whole-session layout: what `up` passes to `--layout` when creating. + * + * The tab template is EMITTED, not inlined into each tab. It used to be + * inlined, because a templated tab came back with `purpose=None` and purpose is + * identity here -- `sl0ppi ls` finds project tabs by it. The fork now keeps a + * tab's own purpose when a template is applied + * (`sl0p_a_templated_tab_keeps_its_own_purpose`), which removes that reason and + * fixes the thing the workaround cost us: a tab created at RUNTIME -- `new-tab` + * from a keybinding, or the bar's `+` button -- had no template to take a + * status bar from, and came up bare. + */ export function sessionLayoutKdl( specs: TabSpec[], template?: string, paneTemplates?: string[], ): string { - const tabs = specs.map((spec) => tabKdl(spec, 4, template)).join("\n"); - return `layout {\n${preamble(paneTemplates)}${tabs}\n}\n`; + const tabs = specs.map((spec) => tabKdl(spec, 4)).join("\n"); + return `layout {\n${preamble(paneTemplates)}${templateBlock(template)}${tabs}\n}\n`; } -/** A one-tab layout: what `up` passes to `new-tab --layout-string`. */ +/** The `default_tab_template { ... }` node, indented into the layout block. */ +function templateBlock(template?: string): string { + if (!template) return ""; + return `${indent(template, 4)}\n`; +} + +/** + * A one-tab layout: what `open` passes to `new-tab --layout-string`. + * + * Still inlined: this layout describes ONE tab being added to a session that + * already exists, and a `default_tab_template` in it would apply to that tab + * anyway -- but the session's own template (if it has one) would apply first, + * and the tab would come up with two status bars. + */ export function singleTabLayoutKdl( spec: TabSpec, template?: string, diff --git a/cli/test/layout.test.ts b/cli/test/layout.test.ts index 1910529..01b59da 100644 --- a/cli/test/layout.test.ts +++ b/cli/test/layout.test.ts @@ -146,19 +146,37 @@ describe("extractDefaultTabTemplate", () => { expect(extractDefaultTabTemplate("layout {\n default_tab_template {\n children\n")).toBeUndefined(); }); - // A templated tab loses its purpose (the fork hangs tab purpose on the tab's - // root layout, which templating replaces), and purpose IS identity here. So - // the template is inlined into each tab rather than emitted as - // default_tab_template. - test("the template is inlined, and the tab keeps its identity", () => { + // This used to assert the opposite -- that the template was INLINED into each + // tab -- because a templated tab came back with purpose=None and purpose is + // identity here. The fork now keeps a tab's own purpose through templating + // (sl0p_a_templated_tab_keeps_its_own_purpose), and inlining had a cost: a + // tab created at runtime (`new-tab`, or the bar's + button) had no template + // to take a status bar from and came up bare. + test("the session layout emits the template, and the tabs keep their identity", () => { const template = 'default_tab_template {\n children\n pane size=1 { plugin location="file:~/z.wasm" }\n}'; const kdl = sessionLayoutKdl([spec], template); - expect(kdl).not.toContain("default_tab_template"); - expect(kdl).toContain('purpose="project:foo"'); // identity survives + expect(kdl).toContain("default_tab_template"); // runtime tabs get a bar + expect(kdl).toContain('purpose="project:foo"'); // identity survives expect(kdl).toContain("z.wasm"); // status bar came along expect(kdl).toContain('purpose="agent:main"'); // the project's own panes - expect(kdl.indexOf('purpose="project:foo"')).toBeLessThan(kdl.indexOf("z.wasm")); + // the template is declared before the tabs that use it + expect(kdl.indexOf("default_tab_template")).toBeLessThan(kdl.indexOf('name="foo"')); + // ...and exactly once, however many tabs there are + const twoTabs = sessionLayoutKdl([spec, { ...spec, name: "bar", relPath: "bar" }], template); + expect(twoTabs.split("z.wasm").length - 1).toBe(1); + }); + + // A layout string handed to a RUNNING session is a different case: the + // session's own template applies to the new tab, so emitting another one + // would give it two status bars. + test("a single-tab layout string still inlines", () => { + const template = 'default_tab_template {\n children\n pane size=1 { plugin location="file:~/z.wasm" }\n}'; + const kdl = singleTabLayoutKdl(spec, template); + + expect(kdl).not.toContain("default_tab_template"); + expect(kdl).toContain("z.wasm"); + expect(kdl).toContain('purpose="project:foo"'); }); test("a template without a children node is skipped rather than mangled", async () => { diff --git a/docs/HANDOVER.md b/docs/HANDOVER.md index 641ac12..1e3fe96 100644 --- a/docs/HANDOVER.md +++ b/docs/HANDOVER.md @@ -167,9 +167,11 @@ bar. See `docs/roadmap.md` for each with its measurements. fails. - **Single-line KDL needs `;` between nodes.** `tab x { pane }` will not parse; emit multi-line. -- **A tab template destroys tab purposes** — identity is a tab `purpose`, and - templating replaces the tab's root layout. That is why `sl0ppi` inlines the - template into each tab instead of emitting `default_tab_template`. +- **A tab template used to destroy tab purposes** — `parse_tab_node_with_template` + never read `purpose` off the tab node, so the template's (none) won. Fixed; + `sl0ppi` emits `default_tab_template` again, which is also what gives a tab + created at runtime a status bar. If you ever revert that line, the CLI has to + go back to inlining, and runtime tabs lose their bar. - **The tab test harness does no rendering**, so `panes_to_hide` is always empty and stack-related bugs cannot be reproduced in it. Use a scripted pty. - **`action list-panes` hides borderless plugin panes once a client attaches.** @@ -189,9 +191,19 @@ bar. See `docs/roadmap.md` for each with its measurements. - **The pane's geometry is not where its frame is drawn.** With a gap, the frame is inset from the allocation: use `Pane::frame_rect()` for anything the user can see, `position_and_size()` only for the layout solver. -- **Clean up test sessions.** A background-created session I left behind is what - produced a "MY FOCUS" bug report from the user. The live checks now reap their - own servers; anything else you spawn by hand, kill by pid via `comm`. +- **Never kill a `sl0ppij` you cannot PROVE is yours.** I killed the user's live + client on the reasoning "there are no user sessions on this box" -- a guess, + not evidence, and wrong. The evidence was right there and said the opposite: a + check's processes always carry that run's own socket dir + (`--server /tmp/sl0p-<run>/...`) or `attach sl0ptest-...`, while a bare + `sl0ppij` with a cwd in the repo is a human's. If the args do not contain your + own temp dir, it is not yours. +- **Clean up test sessions, and DELETE them.** A background-created session I + left behind is what produced a "MY FOCUS" bug report from the user, and + `kill-session` alone leaves them listed as "EXITED - attach to resurrect": + 35 of mine had silently filled the session picker before I noticed. The live + checks now `delete-session` their own session by name; anything you spawn by + hand, clean up the same way. - **`send_cli_scroll_up_action` flakes** (scrolled 1 line where the snapshot has 2), seen once in ~10 full runs. It is the CLI-action raciness already tracked above, not a rendering bug -- re-run before chasing it. diff --git a/docs/roadmap.md b/docs/roadmap.md index 068129f..675f82d 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -355,6 +355,42 @@ render half a box. That one function also returns where the content line starts, and click routing reads it — which is why a click on the new box's border hits nothing instead of the widget underneath. +### A tab made at runtime had no status bar + +Reported as "creating a new tab with the icon from the status bar created a tab +without statusbar" -- but the button was innocent: the `n` keybinding did it +too. A generated session had no `default_tab_template`, so there was nothing for +a runtime tab to take a bar from. + +The reason it had none was the trap recorded below: templating a tab dropped its +`purpose`, and purpose is identity, so the CLI inlined the template into every +tab instead. That trap turned out to be one missing line in the fork -- +`parse_tab_node_with_template` read `name`, `cwd`, `focus` and +`split_direction` off the tab node but never `purpose`, so the template's (None) +won. It now keeps the tab's own, and both properties hold at once: + +| | inlined (before) | templated (before) | templated (now) | +|---|---|---|---| +| tab keeps `purpose` | yes | **no** | yes | +| runtime tab gets a bar | **no** | yes | yes | + +So `sessionLayoutKdl` emits `default_tab_template` again, and the generated +layout shrank further: one copy of the bar's configuration for the session +rather than one per tab. `singleTabLayoutKdl` still inlines -- that layout is +handed to a session that already has a template, and emitting another would give +the new tab two bars. + +`sl0ppi-up-live.py` checks both halves, because fixing either one alone +regresses the other: every tab (including one made at runtime) has exactly one +bar, and `sl0ppi ls` still finds a tab per project. Confirmed by reverting each +half in turn and watching the matching assertion fail. + +Counting bars needs care: `dump-layout` includes the template itself and every +swap layout, so grepping it reports definitions as if they were panes -- that +cost an hour of chasing a doubled bar that did not exist. Count panes per tab +from `list-panes`, and do it BEFORE any client attaches (see the trap about what +that hides). + ### `sl0ppi up` and the generated layout Making the bar a `pane_template` broke `sl0ppi up` outright: @@ -385,6 +421,36 @@ attached it stops reporting the borderless plugin pane, which had me believing the bar was gone in cases where it was on screen the whole time. `dump-layout` and the screen agree; `list-panes` does not. +### A tab made at runtime now gets a status bar + +Clicking the bar's `+` (and pressing `n` in TAB mode) produced a tab with no +status bar in `sl0ppi up` sessions. The button only made it visible: a generated +layout had no `default_tab_template`, so there was nothing for a new tab to take +a bar from. + +The reason it had none was `parse_tab_node_with_template`, which read a tab +node's `name`, `cwd` and `focus` but not its `purpose` -- so templating a tab +erased the purpose that is the CLI's notion of identity, and the CLI worked +around it by inlining the template into every tab. That is now fixed at the +root (`sl0p_a_templated_tab_keeps_its_own_purpose`), and the CLI emits the +template again: + +| | inlined (before) | template (now) | +|---|---|---| +| tab keeps `purpose=` | yes | yes | +| runtime `new-tab` has a bar | **no** | yes | +| copies of the bar's config in the layout | one per tab | one | + +Both halves are checked by `sl0ppi-up-live.py`, because they trade off against +each other: it asserts `sl0ppi ls` still sees a tab per project AND that every +tab, including one created at runtime, has exactly one status bar. + +Count bars per tab from `list-panes`, not by grepping `dump-layout`: that dump +also contains the template itself and every swap layout, so substring counting +there reports "4 bars for 3 tabs" and sends you looking for a doubling bug that +does not exist. And do it before any client attaches, because `list-panes` stops +reporting borderless plugin panes for a tab a client has rendered. + ### Still open on the bar Content and further click targets: a close-`x` per tab, session name → session diff --git a/packaging/checks/plugin-permissions-live.py b/packaging/checks/plugin-permissions-live.py index 7241504..3768ac6 100755 --- a/packaging/checks/plugin-permissions-live.py +++ b/packaging/checks/plugin-permissions-live.py @@ -170,6 +170,10 @@ def main(): subprocess.run( [BIN, "-s", SESSION, "kill-session"], env=env, capture_output=True, text=True ) + # and delete it: a killed session stays in `list-sessions` as + # "EXITED - attach to resurrect", so a day of check runs silently fills + # the user's session picker with test sessions + subprocess.run([BIN, "delete-session", SESSION], env=env, capture_output=True, text=True) try: os.close(fd) except OSError: diff --git a/packaging/checks/sl0ppi-up-live.py b/packaging/checks/sl0ppi-up-live.py index 82b84b9..f3739ad 100755 --- a/packaging/checks/sl0ppi-up-live.py +++ b/packaging/checks/sl0ppi-up-live.py @@ -156,6 +156,60 @@ def main(): # identity: the fork hangs a tab's purpose on its root layout, and the # CLI inlines the template precisely so templating cannot eat it + # Identity: `sl0ppi ls` finds project tabs by the purpose on each tab. + # Emitting a tab template used to erase that -- which is why the CLI + # inlined instead, at the cost of runtime tabs having no bar. Both + # properties have to hold at once, so both are checked here. + listing = subprocess.run( + ["bun", CLI, "ls", "--root", root], env=env, capture_output=True, text=True, timeout=60 + ).stdout + print("sl0ppi ls:", " | ".join(line.strip() for line in listing.strip().splitlines())) + for project in PROJECTS: + if project not in listing: + failures.append(f"`sl0ppi ls` does not see project {project!r}") + # a project with a tab reads "alpha tab 0 1 pane(s) ..."; + # one without reads "alpha —" + if listing.count("tab ") < len(PROJECTS): + failures.append(f"`sl0ppi ls` does not see a tab per project: {listing.strip()!r}") + layout_dump = subprocess.run( + [BIN, "-s", SESSION, "action", "dump-layout"], env=env, capture_output=True, text=True + ).stdout + for project in PROJECTS: + if f'purpose="project:{project}"' not in layout_dump: + failures.append(f"tab for {project!r} lost its purpose= (identity is gone)") + + # A tab made at RUNTIME must come up with a status bar too -- exactly + # one. This is what the bar's `+` button does and what the `n` keybinding + # does; while the CLI inlined its tab template instead of emitting one, + # both produced a bare tab, because there was no template for the new tab + # to take a bar from. + # + # Counted per tab from list-panes rather than by grepping dump-layout: + # that dump also contains the template itself and every swap layout, so + # substring counting there reports bars that are definitions, not panes. + # + # BEFORE any client attaches, too: list-panes stops reporting borderless + # plugin panes for a tab a client has rendered, which reads exactly like + # the bar being missing. + subprocess.run([BIN, "-s", SESSION, "action", "new-tab"], env=env, capture_output=True) + time.sleep(3) + per_tab = {} + panes = subprocess.run( + [BIN, "-s", SESSION, "action", "list-panes", "--json"], + env=env, capture_output=True, text=True, timeout=60, + ).stdout + for pane in json.loads(panes or "[]"): + if pane.get("is_suppressed"): + continue + tab = pane.get("tab_name") or pane.get("tab_position") + per_tab.setdefault(tab, 0) + if "zjstatus" in (pane.get("plugin_url") or ""): + per_tab[tab] += 1 + print(f"status bars per tab after new-tab: {per_tab}") + for tab, count in per_tab.items(): + if count != 1: + failures.append(f"tab {tab!r} has {count} status bars, expected exactly 1") + # The bar has to survive a client attaching, a resize, and auto_layout # swapping the tab around. Read from the SCREEN: `list-panes` stops # reporting the borderless plugin pane once a client is attached, which @@ -192,6 +246,8 @@ def main(): return failures finally: subprocess.run([BIN, "-s", SESSION, "kill-session"], env=env, capture_output=True) + # delete too: killed sessions linger in `list-sessions` as resurrectable + subprocess.run([BIN, "delete-session", SESSION], env=env, capture_output=True) ps = subprocess.run(["ps", "-eo", "pid,comm,args"], capture_output=True, text=True).stdout for line in ps.splitlines(): fields = line.split(None, 2) diff --git a/packaging/checks/split-button-live.py b/packaging/checks/split-button-live.py index cb732e1..b22d372 100755 --- a/packaging/checks/split-button-live.py +++ b/packaging/checks/split-button-live.py @@ -210,17 +210,25 @@ def find_button(rows): def find_buttons(rows): """Every drawn split button: (row, 0-based column of the `+`). - A frame row can hold more than one, once panes sit side by side.""" + A frame row can hold more than one, once panes sit side by side. + + Identified by the CORNER it sits against: the button is the three columns + immediately left of a pane's top-right corner (`split_button_columns`). A + bare " + " search also matches the stack list's "+N more" and the short + multi-client indication, and those share a screen row with a real frame as + soon as two panes sit side by side -- which then reads as a button that does + nothing when clicked, i.e. as this feature's own bug. + """ found = [] for y, line in enumerate(rows): - if "╭" not in line and "┌" not in line: - continue start = 0 while True: at = line.find(" + ", start) if at < 0: break - found.append((y, at + 1)) + corner = line[at + 3] if at + 3 < len(line) else "" + if corner in ("╮", "┐"): # rounded / square top-right + found.append((y, at + 1)) start = at + 1 return found @@ -423,6 +431,10 @@ def main(): subprocess.run( [BIN, "-s", SESSION, "kill-session"], env=env, capture_output=True, text=True ) + # and delete it: a killed session stays in `list-sessions` as + # "EXITED - attach to resurrect", so a day of check runs silently fills + # the user's session picker with test sessions + subprocess.run([BIN, "delete-session", SESSION], env=env, capture_output=True, text=True) # kill-session does not always take the server with it, and a leftover # test session is how a "MY FOCUS" bug report gets filed against nobody. # diff --git a/packaging/checks/status-bar-live.py b/packaging/checks/status-bar-live.py index e5ad8af..e1ef226 100755 --- a/packaging/checks/status-bar-live.py +++ b/packaging/checks/status-bar-live.py @@ -341,6 +341,8 @@ def main(): return failures finally: subprocess.run([BIN, "-s", SESSION, "kill-session"], env=env, capture_output=True) + # delete too: killed sessions linger in `list-sessions` as resurrectable + subprocess.run([BIN, "delete-session", SESSION], env=env, capture_output=True) try: os.close(fd) except OSError: diff --git a/sl0ppij/zellij-utils/src/input/unit/layout_test.rs b/sl0ppij/zellij-utils/src/input/unit/layout_test.rs index 7154d4c..29ad765 100644 --- a/sl0ppij/zellij-utils/src/input/unit/layout_test.rs +++ b/sl0ppij/zellij-utils/src/input/unit/layout_test.rs @@ -3003,6 +3003,63 @@ fn sl0p_pane_purpose_parses_from_kdl_for_tiled_and_floating_panes() { } #[test] +fn sl0p_a_templated_tab_keeps_its_own_purpose() { + // REGRESSION: templating replaces the tab's root layout, and the tab's + // purpose rides that root -- so every tab in a layout with a + // `default_tab_template` came back with purpose=None. Purpose is identity + // (`sl0ppi ls` finds project tabs by it), so the CLI worked around it by + // inlining the template into each tab, which meant a tab created at + // RUNTIME had no template to take a status bar from. + let kdl = r#" + layout { + default_tab_template { + children + pane size=1 borderless=true { + plugin location="zellij:status-bar" + } + } + tab name="alpha" purpose="project:alpha" { + pane name="only" purpose="agent:main" + } + tab name="plain" { + pane + } + } + "#; + let layout = Layout::from_kdl(kdl, Some("w.kdl".into()), None, None).expect("parses"); + let tabs = layout.tabs(); + + let (_, alpha, _) = tabs.first().expect("first tab").clone(); + assert_eq!( + alpha.purpose.as_deref(), + Some("project:alpha"), + "a templated tab keeps the purpose it declared" + ); + // the template wraps them, so the tab's own panes are no longer direct + // children of its root + fn purposes(layout: &TiledPaneLayout, into: &mut Vec<String>) { + if let Some(purpose) = &layout.purpose { + into.push(purpose.clone()); + } + for child in &layout.children { + purposes(child, into); + } + } + let mut found = vec![]; + purposes(&alpha, &mut found); + assert!( + found.iter().any(|p| p == "agent:main"), + "and the panes it declared keep theirs: {found:?}" + ); + + let (_, plain, _) = tabs.get(1).expect("second tab").clone(); + assert_eq!( + plain.purpose, None, + "a tab that declares no purpose still has none" + ); +} + +#[test] fn sl0p_unknown_pane_properties_are_still_rejected() { // Adding `purpose` must not turn the pane property allowlist into "accept // anything" -- a typo in a workspace file should still be a loud error. diff --git a/sl0ppij/zellij-utils/src/kdl/kdl_layout_parser.rs b/sl0ppij/zellij-utils/src/kdl/kdl_layout_parser.rs index 41b4a43..dbedb24 100644 --- a/sl0ppij/zellij-utils/src/kdl/kdl_layout_parser.rs +++ b/sl0ppij/zellij-utils/src/kdl/kdl_layout_parser.rs @@ -1690,6 +1690,21 @@ impl<'a> KdlLayoutParser<'a> { } } tab_layout.external_children_index = None; + // sl0p fork: the tab's own purpose wins over the template's. + // + // Tab-level purpose rides the tab's ROOT layout, and templating + // replaces that root -- so a templated tab silently came back with no + // purpose at all. Purpose IS identity here (`sl0ppi ls` finds project + // tabs by it, and `up` would otherwise create a second set), which is + // why the CLI could not emit a `default_tab_template` and had to inline + // it into every tab instead. The cost of that workaround was a tab made + // at runtime -- `new-tab`, or the bar's `+` button -- having no status + // bar, because there was no template for it to come from. + if let Some(purpose) = kdl_get_string_property_or_child_value!(kdl_node, "purpose") + .and_then(|s| crate::input::layout::sanitize_pane_purpose(s)) + { + tab_layout.purpose = Some(purpose); + } Ok(( is_focused, tab_name, |
