Problem
Mouse interactions in the embedded Ghostty terminal are misaligned — the cursor position the terminal registers doesn't match where the user is actually clicking/dragging. This manifests as:
- Drag-to-select selects wrong text — dragging over visible text highlights a different region than what's under the cursor
- Double-click doesn't highlight the target word/link — double-clicking on a link or word either selects nothing or selects adjacent content instead
- General click targeting is off — there appears to be a spatial offset between the macOS mouse position and where Ghostty thinks the click landed
Expected Behavior
- Drag selection should highlight exactly the text under the cursor
- Double-click should select the word or link directly under the pointer
- Click-to-place-cursor should position the terminal cursor at the clicked location
Likely Cause
This is likely a coordinate translation issue between the SwiftUI/AppKit view hierarchy and the Ghostty surface. Common causes:
- Title bar or toolbar offset — if the terminal surface doesn't account for the window's title bar, toolbar, or tab bar height, all coordinates will be shifted vertically
- Retina/scale factor — mismatch between logical points and pixel coordinates on HiDPI displays
- Safe area insets or padding — extra padding around the terminal view not accounted for in hit testing
- SwiftUI view embedding — if Ghostty is embedded via
NSViewRepresentable or similar, the coordinate space translation between SwiftUI and the underlying NSView may be incorrect
Reproduction
- Open any session with a Ghostty terminal containing text
- Try to select text by clicking and dragging — observe that the selection doesn't match cursor position
- Double-click on a word or URL — observe it doesn't highlight the expected target
Problem
Mouse interactions in the embedded Ghostty terminal are misaligned — the cursor position the terminal registers doesn't match where the user is actually clicking/dragging. This manifests as:
Expected Behavior
Likely Cause
This is likely a coordinate translation issue between the SwiftUI/AppKit view hierarchy and the Ghostty surface. Common causes:
NSViewRepresentableor similar, the coordinate space translation between SwiftUI and the underlying NSView may be incorrectReproduction