From f4886bb80ec5cfb004868614eff13549693265f1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 25 Sep 2023 17:26:23 -0700 Subject: [PATCH] macos: read from clipboard uses UTF-8 encoded string, proper byte count --- macos/Sources/Ghostty/AppState.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macos/Sources/Ghostty/AppState.swift b/macos/Sources/Ghostty/AppState.swift index 55a5b7b50..8ecaf0941 100644 --- a/macos/Sources/Ghostty/AppState.swift +++ b/macos/Sources/Ghostty/AppState.swift @@ -334,7 +334,9 @@ extension Ghostty { } static private func completeClipboardRequest(_ surface: ghostty_surface_t, data: String, state: UnsafeMutableRawPointer?) { - ghostty_surface_complete_clipboard_request(surface, data, UInt(data.count), state) + data.withCString { ptr in + ghostty_surface_complete_clipboard_request(surface, ptr, UInt(data.utf8.count), state) + } } static func writeClipboard(_ userdata: UnsafeMutableRawPointer?, string: UnsafePointer?, location: ghostty_clipboard_e) {