macos: insertText should not include null char

This commit is contained in:
Mitchell Hashimoto
2023-10-14 21:06:34 -07:00
parent 6895613d20
commit 6990c1572a

View File

@ -843,8 +843,11 @@ extension Ghostty {
} }
let len = chars.utf8CString.count let len = chars.utf8CString.count
if (len == 0) { return }
chars.withCString { ptr in chars.withCString { ptr in
ghostty_surface_text(surface, ptr, UInt(len)) // len includes the null terminator so we do len - 1
ghostty_surface_text(surface, ptr, UInt(len - 1))
} }
} }