diff --git a/macos/Sources/Ghostty/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/SurfaceView_AppKit.swift index 8663c922a..251ddeaa8 100644 --- a/macos/Sources/Ghostty/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/SurfaceView_AppKit.swift @@ -998,7 +998,15 @@ extension Ghostty.SurfaceView: NSServicesMenuRequestor { } func readSelection(from pboard: NSPasteboard) -> Bool { - // TODO - return false + guard let str = pboard.string(forType: .string) else { return false } + + let len = str.utf8CString.count + if (len == 0) { return true } + str.withCString { ptr in + // len includes the null terminator so we do len - 1 + ghostty_surface_text(surface, ptr, UInt(len - 1)) + } + + return true } }