Skip to content

Commit 05f88d3

Browse files
authored
fix(terminal): prevent cursor movement on double-click selection (manaflow-ai#1709)
Double-clicking to select text in the terminal was causing unwanted cursor movement because the mouse position was being updated on both the first and second clicks. This disrupted the selection gesture and caused the cursor to jump to a different position than intended. Fix by only updating the mouse position on the first click (clickCount == 1), allowing the terminal's selection logic to handle multi-click gestures without cursor interference. Fixes manaflow-ai#1698 Co-authored-by: BillionClaw <267901332+BillionClaw@users.noreply.github.com>
1 parent 3efd947 commit 05f88d3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Sources/GhosttyTerminalView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5868,7 +5868,11 @@ class GhosttyNSView: NSView, NSUserInterfaceValidations {
58685868
}
58695869
guard let surface = surface else { return }
58705870
let point = convert(event.locationInWindow, from: nil)
5871-
ghostty_surface_mouse_pos(surface, point.x, bounds.height - point.y, modsFromEvent(event))
5871+
// Only update mouse position on the first click to prevent unwanted cursor
5872+
// movement during double-click selection (issue #1698)
5873+
if event.clickCount == 1 {
5874+
ghostty_surface_mouse_pos(surface, point.x, bounds.height - point.y, modsFromEvent(event))
5875+
}
58725876
_ = ghostty_surface_mouse_button(surface, GHOSTTY_MOUSE_PRESS, GHOSTTY_MOUSE_LEFT, modsFromEvent(event))
58735877
}
58745878

0 commit comments

Comments
 (0)