Skip to content

Keep loop bar text clear of its buttons at narrow widths - #642

Merged
coneilen merged 1 commit into
mainfrom
coneilen-fix-loop-bar-narrow-overlap
Oct 7, 2026
Merged

coneilen merged 1 commit into
mainfrom
coneilen-fix-loop-bar-narrow-overlap

Conversation

@coneilen

@coneilen coneilen commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

On the beta10 Dev Box qualification (100% DPI, 960px shell, sidebar rail and loop detail panel visible) the workspace loop bar drew its metadata line (copilotCLI · elapsed >1h · pass 0 · usage n/a) underneath the Stop loop and Show in graph buttons. This makes every loop-bar text run stay to the left of the leftmost button at any width, while leaving the wide-window layout unchanged.

Changes

  • New pure graphcode-windows/src/LoopBarLayout.zig computes the bar's geometry: stripe, title, state, activity, and metadata text rects, plus the Stop and Show in graph button rects. Text rects are clamped to 8px left of the leftmost button (Show in graph when the loop is resolved), and a run narrower than 24px is dropped. At widths where nothing is clamped, every rect is identical to the previous hard-coded geometry.
  • TerminalSurface.paintLoopBar paints from that layout. Clamped text runs are drawn with DT_END_ELLIPSIS; unclamped runs keep the previous 220px clip with no ellipsis.
  • loopBarActionAt (mouse hit-testing) and the workspace-loop-bar / workspace-stop / workspace-show-graph UIA bounds in App.zig now read the same layout, so drawn buttons, clicks, and UIA share one source of truth. The numbers are unchanged: buttons still sit at the same offsets, clicks still accept the bar's full height in the button columns, and UIA bounds are still the 26px button rects.
  • The new test root is registered in Tools/windows/Tests/WindowsShell.Tests.ps1 ("Loop bar layout executable tests"; -PlanOnly assigns it to shard 2 of 3, catalog now 55 sections).
  • investigation/ui-parity-matrix.md Loop bar row goes from Validated to Partial. The overlap was a live defect, and the fix has only unit-test evidence. At 960px with the rail and panel visible, the metadata line is now dropped (4px of room), whereas macOS truncates within an HStack. The dated 2026-10-01 audit total (62/36) is a historical snapshot and is left as written.

Elapsed/age computation is untouched (another session owns the elapsedLabel epoch fix).

Not changed, noted for follow-up: the mouse hit-test in App.zig passes client.right - loop_detail_width even when the detail panel is hidden, while paint and UIA use the full width in that state. In that state the panel expand control is also painted over Show in graph. Fixing that needs a layout decision for the expand control, so it is out of scope here.

Test plan

All commands ran from graphcode-windows with the pinned Zig 0.15.2 (C:\gc-tools\zig-0.15.2\zig.exe). RED was taken with the final tests against LoopBarLayout.zig whose compute reproduced the pre-fix unclamped geometry. The failing assertion is !run.intersects(layout.show_graph) / !run.intersects(stop), a behavioral failure, not a compile error. The 960px case puts the metadata rect at x 480..700, across Stop 492..576 and Show in graph 584..676.

RED: zig test src\LoopBarLayout.zig (unclamped pre-fix geometry) -> 2 passed; 0 skipped; 4 failed: 960px, 1056px, extremely narrow, and resolved cases fail expectClearOfButtons because text rects intersect the Show in graph and Stop rects; the 1280px unchanged-geometry and hit tests pass
GREEN: zig test src\LoopBarLayout.zig -> All 6 tests passed
REGRESSION: zig test src\TerminalSurface.zig -target x86_64-windows-msvc -lc -luser32 -lgdi32 -ladvapi32 -I C:\gc-providers\winghostty\include plus ghostty-vt-static.lib -> All 146 tests passed, including 6 LoopBarLayout and the existing loop bar action test

Additional checks and their limits:

  • zig test src\App.zig -DUNICODE -D_UNICODE -target x86_64-windows-msvc -lc -I...\winghostty\include -fno-emit-bin: exit 0, semantic analysis only. No Winghostty host lib was available locally, so App tests were not executed. A temporary type-error probe confirmed this analysis reaches the changed syncAccessibility code.
  • zig build-exe src\main.zig ... -fno-emit-bin with a stub build_options module: exit 0. A probe confirmed it analyzes paintLoopBar → drawUtf8Bounded, and it caught a DrawTextW format-type error that was fixed before commit.
  • The TerminalSurface run linked a read-only ghostty-vt-static.lib prebuilt in another local worktree, not one produced by prepare-terminal-vt in this branch.
  • WindowsShell.Tests.ps1 -PlanOnly -Shard 0..2 -ShardCount 3: the new section is planned on shard 2.
  • Not run locally: zig build, validate.ps1 -Task windows-shell, the App executable tests, and the UIA live gate. CI covers these.
  • No live UI observation was made. Nothing here proves real glyph rendering, the actual ellipsis appearance, or the 960px layout on hardware.

Checklist

  • I have read the Contributing Guidelines
  • I have signed off my commits (git commit -s) per the DCO
  • Tests pass locally (make test) (macOS-only target; not run. This change is Windows-only. Focused Zig tests above)
  • Code follows the existing style (make check) (macOS Swift lint; not applicable to these Zig files; not run)
  • I added the test/contract before the implementation and observed the intended RED failure

At a 960px window with the sidebar rail and loop detail panel visible, the
loop bar's metadata line (backend, elapsed, pass, usage) was drawn at a fixed
offset into a fixed 220px rect and ran underneath Stop loop and Show in graph.

Extract the bar geometry into LoopBarLayout.zig and use it as the single
source for painting, mouse hit-testing, and UIA bounds. Every text run is now
clamped to the space left of the leftmost button, ellipsized when squeezed,
and dropped when narrower than 24px. Wide-window geometry is unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen force-pushed the coneilen-fix-loop-bar-narrow-overlap branch from 6a7dc5d to f2fce0e Compare October 6, 2026 23:59
@coneilen
coneilen merged commit 56e00ca into main Oct 7, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant