Skip to content

Retain button labels and use readable text colors - #406

Merged
forketyfork merged 3 commits into
mainfrom
fix/ui-button-readability
Sep 11, 2026
Merged

Retain button labels and use readable text colors#406
forketyfork merged 3 commits into
mainfrom
fix/ui-button-readability

Conversation

@forketyfork

Copy link
Copy Markdown
Owner

Issue

Outlined Cancel labels can render nearly black against dark button fills. Worktree Confirm and related button labels can also flicker during caret-driven redraws because their SDL textures are created and destroyed in the same frame.

Solution

Use the theme foreground for outlined button labels so they remain readable against selection fills. Retain button and modal-label SDL textures across frames, invalidating them when their font, text, or color changes. Apply the same lifetime fix to related action buttons and register a unit test for the shared color policy.

Context

This follows the existing UI rendering invariant that textures queued by SDL's Metal backend must not be destroyed within the frame that renders them.

Test plan

  • Open the worktree dialog with a dark theme and verify Confirm and Cancel labels remain readable.
  • Type in the worktree name field while the caret blinks and verify the Confirm label remains stable.
  • Review the quit, diff comment, reader, and related action buttons for readable, non-flickering labels.

Issue: Fix dark Cancel labels and button text flickering during caret-driven redraws, and address the same texture-lifetime problem in related UI buttons.
Solution: Use readable theme foreground colors for outlined labels and retain cached SDL text textures across frames. Invalidate caches when fonts, labels, or colors change so dynamic modal text remains correct without same-frame texture destruction.
@forketyfork
forketyfork marked this pull request as ready for review September 11, 2026 13:56
@forketyfork
forketyfork requested a balanced review from Copilot September 11, 2026 13:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The remove-modal path label is still created and destroyed within the frame, leaving the stated rendering issue partially unresolved.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Retains UI label textures to prevent Metal rendering flicker and improves button-label readability.

Changes:

  • Adds reusable cached button-label textures.
  • Applies caching across worktree, reader, quit, and diff actions.
  • Registers color-policy tests and documents the rendering invariant.
File summaries
File Description
src/ui/components/button.zig Adds texture caching and label-color policy.
src/ui/components/worktree_overlay.zig Retains modal and button labels.
src/ui/components/reader_overlay.zig Caches the jump-button label.
src/ui/components/quit_confirm.zig Caches confirmation button labels.
src/ui/components/diff_overlay.zig Caches comment and send-button labels.
src/main.zig Registers button tests.
docs/ARCHITECTURE.md Documents retained texture requirements.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/ui/components/worktree_overlay.zig
Address review comment 3989851456: retain the remove-modal path textures across frames.

Cache wrapped path lines by their source text, font identity and generation, color, and available width, and release them when the removal target changes or the modal closes.
Issue: The worktree removal-modal cache refactor left a stale method-style call that made the macOS build fail during compilation.\nSolution: Invoke the static cached-path renderer with the cache pointer it expects, preserving the existing texture cache while restoring type-correct compilation.
@forketyfork
forketyfork merged commit 292b93f into main Sep 11, 2026
4 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.

2 participants