remove stage1 hack

This commit is contained in:
Mitchell Hashimoto
2022-11-01 13:25:20 -07:00
parent 3d5ea05565
commit f09ba38c6f
2 changed files with 7 additions and 17 deletions

View File

@ -80,13 +80,13 @@ pub const Config = struct {
try result.keybind.set.put( try result.keybind.set.put(
alloc, alloc,
.{ .key = .c, .mods = .{ .super = true } }, .{ .key = .c, .mods = .{ .super = true } },
.{ .copy_to_clipboard = 0 }, .{ .copy_to_clipboard = {} },
); );
try result.keybind.set.put( try result.keybind.set.put(
alloc, alloc,
.{ .key = .v, .mods = .{ .super = true } }, .{ .key = .v, .mods = .{ .super = true } },
.{ .paste_from_clipboard = 0 }, .{ .paste_from_clipboard = {} },
); );
try result.keybind.set.put(alloc, .{ .key = .up }, .{ .csi = "A" }); try result.keybind.set.put(alloc, .{ .key = .up }, .{ .csi = "A" });
@ -122,7 +122,7 @@ pub const Config = struct {
try result.keybind.set.put( try result.keybind.set.put(
alloc, alloc,
.{ .key = .down, .mods = .{ .shift = true, .super = true } }, .{ .key = .down, .mods = .{ .shift = true, .super = true } },
.{ .toggle_dev_mode = 0 }, .{ .toggle_dev_mode = {} },
); );
return result; return result;

View File

@ -95,12 +95,6 @@ pub fn parse(input: []const u8) !Binding {
break :action @unionInit(Action, field.name, {}); 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 u8 => {
const idx = colonIdx orelse return Error.InvalidFormat; const idx = colonIdx orelse return Error.InvalidFormat;
const param = actionRaw[idx + 1 ..]; 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. /// The set of actions that a keybinding can take.
pub const Action = union(enum) { 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, /// Ignore this key combination, don't send it to the child process,
/// just black hole it. /// just black hole it.
ignore: void, ignore: void,
@ -131,18 +121,18 @@ pub const Action = union(enum) {
/// This action is used to flag that the binding should be removed /// This action is used to flag that the binding should be removed
/// from the set. This should never exist in an active set and /// from the set. This should never exist in an active set and
/// `set.put` has an assertion to verify this. /// `set.put` has an assertion to verify this.
unbind: Void, unbind: void,
/// Send a CSI sequence. The value should be the CSI sequence /// Send a CSI sequence. The value should be the CSI sequence
/// without the CSI header ("ESC ]" or "\x1b]"). /// without the CSI header ("ESC ]" or "\x1b]").
csi: []const u8, csi: []const u8,
/// Copy and paste. /// Copy and paste.
copy_to_clipboard: Void, copy_to_clipboard: void,
paste_from_clipboard: Void, paste_from_clipboard: void,
/// Dev mode /// Dev mode
toggle_dev_mode: Void, toggle_dev_mode: void,
}; };
/// Trigger is the associated key state that can trigger an action. /// Trigger is the associated key state that can trigger an action.