fix: clamp cursor to buffer in toggle_cursel_prefix

This commit is contained in:
CJ van den Berg 2025-01-03 21:04:32 +01:00
parent 023298cc47
commit 1ad6b8db3d
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -2723,6 +2723,7 @@ pub const Editor = struct {
const new_text = text_manip.toggle_prefix_in_text(self.prefix, text, alloc) catch return error.Stop;
root = self.insert(root, cursel, new_text, allocator) catch return error.Stop;
cursel.* = saved;
cursel.cursor.clamp_to_buffer(root, self.metrics);
return root;
}