From f09ba38c6f5dea8734bc6fd5b4d87973a56fde6e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 1 Nov 2022 13:25:20 -0700 Subject: [PATCH] remove stage1 hack --- src/config.zig | 6 +++--- src/input/Binding.zig | 18 ++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/config.zig b/src/config.zig index 02fa61d5e..a35885ad1 100644 --- a/src/config.zig +++ b/src/config.zig @@ -80,13 +80,13 @@ pub const Config = struct { try result.keybind.set.put( alloc, .{ .key = .c, .mods = .{ .super = true } }, - .{ .copy_to_clipboard = 0 }, + .{ .copy_to_clipboard = {} }, ); try result.keybind.set.put( alloc, .{ .key = .v, .mods = .{ .super = true } }, - .{ .paste_from_clipboard = 0 }, + .{ .paste_from_clipboard = {} }, ); try result.keybind.set.put(alloc, .{ .key = .up }, .{ .csi = "A" }); @@ -122,7 +122,7 @@ pub const Config = struct { try result.keybind.set.put( alloc, .{ .key = .down, .mods = .{ .shift = true, .super = true } }, - .{ .toggle_dev_mode = 0 }, + .{ .toggle_dev_mode = {} }, ); return result; diff --git a/src/input/Binding.zig b/src/input/Binding.zig index fce563b08..f6e602fc5 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -95,12 +95,6 @@ pub fn parse(input: []const u8) !Binding { break :action @unionInit(Action, field.name, {}); }, - // see note about what Void is - Action.Void => { - if (colonIdx != null) return Error.InvalidFormat; - break :action @unionInit(Action, field.name, 0); - }, - []const u8 => { const idx = colonIdx orelse return Error.InvalidFormat; const param = actionRaw[idx + 1 ..]; @@ -120,10 +114,6 @@ pub fn parse(input: []const u8) !Binding { /// The set of actions that a keybinding can take. pub const Action = union(enum) { - // stage1 compiler bug where if this is "void" then it crashes the - // compiler. TODO: check this out when we upgrade to stage2. - const Void = u0; - /// Ignore this key combination, don't send it to the child process, /// just black hole it. ignore: void, @@ -131,18 +121,18 @@ pub const Action = union(enum) { /// This action is used to flag that the binding should be removed /// from the set. This should never exist in an active set and /// `set.put` has an assertion to verify this. - unbind: Void, + unbind: void, /// Send a CSI sequence. The value should be the CSI sequence /// without the CSI header ("ESC ]" or "\x1b]"). csi: []const u8, /// Copy and paste. - copy_to_clipboard: Void, - paste_from_clipboard: Void, + copy_to_clipboard: void, + paste_from_clipboard: void, /// Dev mode - toggle_dev_mode: Void, + toggle_dev_mode: void, }; /// Trigger is the associated key state that can trigger an action.