fix: prevent an integer overflow in editor.cancel_all_selections() on project switch

This commit is contained in:
CJ van den Berg 2025-01-17 20:52:34 +01:00
parent e1b1591167
commit d2735a5dd7
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1568,7 +1568,7 @@ pub const Editor = struct {
}
fn cancel_all_selections(self: *Self) void {
var primary = self.cursels.getLast() orelse CurSel{};
var primary = self.get_primary().*;
primary.selection = null;
self.cursels.clearRetainingCapacity();
self.cursels.addOneAssumeCapacity().* = primary;