refactor: prevent duplicate triggers
This commit is contained in:
parent
ed027b5f6d
commit
96676c738a
1 changed files with 1 additions and 0 deletions
|
|
@ -6240,6 +6240,7 @@ pub const Editor = struct {
|
|||
}
|
||||
|
||||
pub fn add_symbol_trigger(self: *Self, char: u8, command_: command.ID, event: TriggerEvent) error{OutOfMemory}!void {
|
||||
for (self.get_event_triggers(event).items) |item| if (item.char == char and item.command == command_) return;
|
||||
(try self.get_event_triggers(event).addOne(self.allocator)).* = .{ .char = char, .command = command_ };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue