cmux NEXT Home: search text stays beside the magnifier while editing

Merged
AU
6d ago
+43-3

Fixes https://github.com/manaflow-ai/cmux/issues/27967

Changelog: Fixed: the Home search field's text no longer slides over the magnifier while you type; it stays centred beside the magnifier, level with the filter button.

Cause

While editing, the Home list's unbezeled search field put its field editor at the field's left edge (x = 0). NSSearchFieldCell.edit/select puts the editor in whatever frame the cell is handed, and the cell handed it the field's full width. So "Search", the caret and typed text drew over the magnifier. At rest the cell draws in searchTextRect, which looked fine.

Fix

CmuxSidebarSearchFieldCell hands edit(withFrame:) and select(withFrame:) its searchTextRect(forBounds:). That rect is clear of the magnifier and cancel button, and the cell already centres it on one line. A bezeled field, as used in classic CmuxSidebarView / SidebarView, keeps AppKit's frame.

Tests

New HomeSearchGlassTests.theTypedTextStaysRightOfTheMagnifier at widths 180, 320 and 480. It makes the field first responder and checks that the field editor starts clear of the magnifier slot and at the placeholder's resting x, within 1 pt. AppKit's own text rect starts 1 pt inside its magnifier slot, even at rest. It then types text, which shows the cancel button, and checks again. Both editing tests now close their windows.

Visual (real app, cmux DEV 27967-chief-search-align, fleet build 9063d03cc6c023f20b2b3a8d at e118113583e2, rechecked on build cc2ae106e5741909a23b1be8 at the merged head cccbc177c62f (same ink columns); base build 08541a94af5cd86c73716c61 at dc38061f72c6)

Measured with debug.home.sidebar_fixture and debug.window_snapshot on the 2x window:

statemagnifier ink x / centre ytext ink start x / centre yfilter centre y
base, rest52–76 / 52.093 / 51.551.5
base, editingmerged with text, 41–8341 (over the magnifier)52.0
fix, rest52–76 / 52.093 / 51.551.5
fix, editing52–76 / 52.093 / 51.552.0

Resizing the list while editing ({"search":true,"width":400}, then {"width":320}) keeps the same ink positions. Images are in the visual review comment.

Fleet capture

Capture tour-home at e118113583e2 (fleet build, capture mini, text checked for private data)

LightDark
lightdark

Viewed after image: yes
Visual verdict: Yes: in light and dark the magnifier, the "Search" placeholder and the round filter button sit on one line, and while editing the text stays beside the magnifier instead of over it, as in Messages.

Coordination

https://github.com/manaflow-ai/cmux/issues/27950 (Chief search content) touches the search results, not the field's cell or header layout. The two changes share no source files.

Observed / Not run

  • Observed: red/green of HomeSearchGlassTests on the fleet; real-app captures on the tagged dev build at this head.
  • Not run: real keyboard typing in the app (no focus-free route; the unit test types into the field editor); the full CmuxNext suite (the change is one cell class used by the Home list and the classic sidebars, and the bezeled path is unchanged); hover/press states (unchanged).

šŸ¤– Generated with Claude Code