From 550151882a93b9272d381df29ab10b2041981359 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 24 Aug 2026 12:48:45 -0700 Subject: [PATCH] macos: restore paste semantics for dropped text Discussion #13979 Dropped paths and text once again honor bracketed paste mode. IME, dictation, emoji picker, and character viewer commits remain typed input. sendText calls ghostty_surface_text, which applies the clipboard paste pipeline and bracketed paste framing when enabled. Separating the paths at the drag-and-drop caller preserves the input-method behavior introduced by #13817. --- macos/Sources/Ghostty/Ghostty.Surface.swift | 5 +++-- macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift | 5 +---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/macos/Sources/Ghostty/Ghostty.Surface.swift b/macos/Sources/Ghostty/Ghostty.Surface.swift index a076063d5..0ccf51c9f 100644 --- a/macos/Sources/Ghostty/Ghostty.Surface.swift +++ b/macos/Sources/Ghostty/Ghostty.Surface.swift @@ -44,8 +44,9 @@ extension Ghostty { } } - /// Send text to the terminal as if it was typed. This doesn't send the key events so keyboard - /// shortcuts and other encodings do not take effect. + /// Send text to the terminal using paste semantics. This doesn't send key events, so keyboard + /// shortcuts and other encodings do not take effect. Bracketed paste framing is applied when + /// the terminal has enabled it. @MainActor func sendText(_ text: String) { let len = text.utf8CString.count diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift index 0dbdeefef..06b185985 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift @@ -2305,10 +2305,7 @@ extension Ghostty.SurfaceView { if let content { DispatchQueue.main.async { - self.insertText( - content, - replacementRange: NSRange(location: 0, length: 0) - ) + self.surfaceModel?.sendText(content) } return true }