Skip to content

surface(macos): offset search overlay when occluding results#12960

Closed
alexbathome wants to merge 3 commits into
ghostty-org:mainfrom
alexbathome:alexb/macos-search-move-on-occlude
Closed

surface(macos): offset search overlay when occluding results#12960
alexbathome wants to merge 3 commits into
ghostty-org:mainfrom
alexbathome:alexb/macos-search-move-on-occlude

Conversation

@alexbathome

@alexbathome alexbathome commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Context

This PR resolves issue #12512

When searching it is possible for the search result to be matched "under" the search bar itself. Leaving a confusing display to the user.

This PR, modifies the search_selected action/SearchSelected message such that we can pass back the search results viewport coordinates. This allows us to calculate an "avoidance" offset in the Swift UI code and "offset" the Search Bar's location on the display revealing the matched result underneath.

A more pragmatic approach might be to detect the intersection between the search bar's rect and the result's rect and then using the Swift anchor/corners to move the bar around the display. I opted to use this offset approach because I find it a bit more aesthetic.

See example screen recording here:

Screen.Recording.2026-06-08.at.11.08.10.pm.mov

Notes

  1. I am a bit uncertain about making a modification like this to the Action union because of how it impacts ABI. The comment guide explains that new actions should be appended to the end of the enum - however since this is a mutation of the existing search_selected key what is the preferred approach here? (The mutation definitely breaks ABI regardless)
  2. AI USAGE: I have never written swift before and I couldn't get the LSPs, or the build.nu to give me any real valuable output - I'll have to sit down and work through some Swift dev in my own time to gather that skill set, in this case most of the Swift code was generously provided by claude. If any other contributors are keen on Swift and don't mind reaching out to give me some pointers please do!
  3. I don't quite have a solid approach for it yet, but I was pondering a method to pass arbitrary Rect/Point data through the Surface message box as a ✨ generic action ✨ perhaps? This would at least give us a path forward if there's ever the need for this sort of reactive UI to screen/terminal content - Someting to think about.

@alexbathome alexbathome requested review from a team as code owners June 8, 2026 15:17
@alexbathome alexbathome marked this pull request as draft June 8, 2026 15:17
@bo2themax

Copy link
Copy Markdown
Member

Hi Alex, I’m already working on this. The terminal part is under review. Claude did the most part. You are welcome to leave a review at #12942.

@alexbathome

Copy link
Copy Markdown
Contributor Author

Hi Alex, I’m already working on this. The terminal part is under review. Claude did the most part. You are welcome to leave a review at #12942.

Oh excellent work! Thanks @bo2themax ! I'll close this in favour of #12942

@alexbathome alexbathome closed this Jun 8, 2026
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