textinput: fix deleteToEnd

Fix behavior of deleteToEnd to delete the character underneath the
cursor to the end of the line.
This commit is contained in:
Tim Culverhouse 2024-03-18 08:06:44 -05:00
parent 8e76610617
commit f18f6328bb

View file

@ -134,11 +134,9 @@ fn byteOffsetToCursor(self: TextInput) usize {
}
fn deleteToEnd(self: *TextInput) !void {
self.cursor_idx += 1;
const offset = self.byteOffsetToCursor();
try self.buf.replaceRangeAfter(offset, self.buf.realLength(), &.{});
try self.buf.replaceRangeAfter(offset, self.buf.realLength() - offset, &.{});
self.grapheme_count = self.cursor_idx;
self.cursor_idx -= 1;
}
fn deleteToStart(self: *TextInput) !void {