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:
parent
8e76610617
commit
f18f6328bb
1 changed files with 1 additions and 3 deletions
|
@ -134,11 +134,9 @@ fn byteOffsetToCursor(self: TextInput) usize {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deleteToEnd(self: *TextInput) !void {
|
fn deleteToEnd(self: *TextInput) !void {
|
||||||
self.cursor_idx += 1;
|
|
||||||
const offset = self.byteOffsetToCursor();
|
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.grapheme_count = self.cursor_idx;
|
||||||
self.cursor_idx -= 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deleteToStart(self: *TextInput) !void {
|
fn deleteToStart(self: *TextInput) !void {
|
||||||
|
|
Loading…
Reference in a new issue