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

@ -841,10 +841,13 @@ extension Ghostty {
default:
return
}
let len = chars.utf8CString.count
if (len == 0) { return }
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))
}
}