widgets(textinput): fix grapheme API

This commit is contained in:
Tim Culverhouse 2024-04-29 14:21:03 -05:00
parent 8a71cd4c85
commit 4e3a53c536

View file

@ -79,7 +79,7 @@ pub fn insertSliceAtCursor(self: *TextInput, data: []const u8) !void {
var iter = self.unicode.graphemeIterator(data); var iter = self.unicode.graphemeIterator(data);
var byte_offset_to_cursor = self.byteOffsetToCursor(); var byte_offset_to_cursor = self.byteOffsetToCursor();
while (iter.next()) |text| { while (iter.next()) |text| {
try self.buf.insertSliceBefore(byte_offset_to_cursor, text.slice(data)); try self.buf.insertSliceBefore(byte_offset_to_cursor, text.bytes(data));
byte_offset_to_cursor += text.len; byte_offset_to_cursor += text.len;
self.cursor_idx += 1; self.cursor_idx += 1;
self.grapheme_count += 1; self.grapheme_count += 1;