fix: check selection before insert

This commit is contained in:
CJ van den Berg 2025-10-02 22:49:02 +02:00
parent 7963e20058
commit 8476f613c2
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -2632,6 +2632,7 @@ pub const Editor = struct {
}
pub fn insert(self: *Self, root: Buffer.Root, cursel: *CurSel, s: []const u8, allocator: Allocator) !Buffer.Root {
cursel.check_selection(root, self.metrics);
var root_ = if (cursel.selection) |_| try self.delete_selection(root, cursel, allocator) else root;
const cursor = &cursel.cursor;
const begin = cursel.cursor;