fix: caching of keybind.insert_command IDs
This commit is contained in:
parent
e9f170372d
commit
22cc818ad6
1 changed files with 3 additions and 5 deletions
|
@ -145,6 +145,7 @@ const BindingSet = struct {
|
||||||
namespace_name: []const u8,
|
namespace_name: []const u8,
|
||||||
mode_name: []const u8,
|
mode_name: []const u8,
|
||||||
insert_command: []const u8,
|
insert_command: []const u8,
|
||||||
|
insert_command_id: ?command.ID = null,
|
||||||
|
|
||||||
const KeySyntax = enum { flow, vim };
|
const KeySyntax = enum { flow, vim };
|
||||||
const OnMatchFailure = enum { insert, ignore };
|
const OnMatchFailure = enum { insert, ignore };
|
||||||
|
@ -307,13 +308,10 @@ const BindingSet = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flush(self: *@This()) !void {
|
fn flush(self: *@This()) !void {
|
||||||
const Static = struct {
|
|
||||||
var insert_chars_id: ?command.ID = null;
|
|
||||||
};
|
|
||||||
if (self.input_buffer.items.len > 0) {
|
if (self.input_buffer.items.len > 0) {
|
||||||
defer self.input_buffer.clearRetainingCapacity();
|
defer self.input_buffer.clearRetainingCapacity();
|
||||||
const id = Static.insert_chars_id orelse
|
const id = self.insert_command_id orelse
|
||||||
command.get_id_cache(self.insert_command, &Static.insert_chars_id) orelse {
|
command.get_id_cache(self.insert_command, &self.insert_command_id) orelse {
|
||||||
return tp.exit_error(error.InputTargetNotFound, null);
|
return tp.exit_error(error.InputTargetNotFound, null);
|
||||||
};
|
};
|
||||||
if (!builtin.is_test) {
|
if (!builtin.is_test) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue