macos: support reading service result text into terminal

This commit is contained in:
Mitchell Hashimoto
2024-01-21 17:26:41 -08:00
parent 4dbd10c913
commit 81532c0b56

View File

@ -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
}
}