fix selection start updating to new len

This commit is contained in:
Muki Kiboigo
2026-01-20 11:25:04 -08:00
parent 4a5c93988f
commit 7650e0b61a
2 changed files with 4 additions and 4 deletions

View File

@@ -290,8 +290,8 @@ pub fn innerInsert(self: *Input, str: []const u8, page: *Page) !void {
// if the input is fully selected, replace the content. // if the input is fully selected, replace the content.
const new_value = try arena.dupe(u8, str); const new_value = try arena.dupe(u8, str);
try self.setValue(new_value, page); try self.setValue(new_value, page);
self._selection_start = 1; self._selection_start = @intCast(new_value.len);
self._selection_end = 1; self._selection_end = @intCast(new_value.len);
self._selection_direction = .none; self._selection_direction = .none;
}, },
.partial => |range| { .partial => |range| {

View File

@@ -138,8 +138,8 @@ pub fn innerInsert(self: *TextArea, str: []const u8, page: *Page) !void {
// if the text area is fully selected, replace the content. // if the text area is fully selected, replace the content.
const new_value = try arena.dupe(u8, str); const new_value = try arena.dupe(u8, str);
try self.setValue(new_value, page); try self.setValue(new_value, page);
self._selection_start = 1; self._selection_start = @intCast(new_value.len);
self._selection_end = 1; self._selection_end = @intCast(new_value.len);
self._selection_direction = .none; self._selection_direction = .none;
}, },
.partial => |range| { .partial => |range| {