feat: always add a toggle_input_mode keybinding (f2)
Even if it is not configured for the mode. This allows the user to switch to the next mode even if the mode could not be loaded/parsed properly.
This commit is contained in:
parent
22fdff4543
commit
031d57a54d
1 changed files with 5 additions and 0 deletions
|
@ -206,6 +206,11 @@ const BindingSet = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_json(self: *@This(), json_string: []const u8, namespace_name: []const u8, mode_name: []const u8) !void {
|
fn load_json(self: *@This(), json_string: []const u8, namespace_name: []const u8, mode_name: []const u8) !void {
|
||||||
|
defer self.bindings.append(.{
|
||||||
|
.keys = self.allocator.dupe(KeyEvent, &[_]KeyEvent{.{ .key = input.key.f2 }}) catch @panic("failed to add toggle_input_mode fallback"),
|
||||||
|
.command = self.allocator.dupe(u8, "toggle_input_mode") catch @panic("failed to add toggle_input_mode fallback"),
|
||||||
|
.args = "",
|
||||||
|
}) catch {};
|
||||||
const parsed = try std.json.parseFromSlice(std.json.Value, self.allocator, json_string, .{});
|
const parsed = try std.json.parseFromSlice(std.json.Value, self.allocator, json_string, .{});
|
||||||
defer parsed.deinit();
|
defer parsed.deinit();
|
||||||
if (parsed.value != .object) return error.NotAnObject;
|
if (parsed.value != .object) return error.NotAnObject;
|
||||||
|
|
Loading…
Add table
Reference in a new issue