From 090e9acdb744fdb8d6c7efcee41da74fcf7c542c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:08:29 -0300 Subject: modal, normal: the twelve prefix roles take config.zig's names (goto_prefix, find_char_fwd, register_prefix...), so normalInput reads every binding by the role's own name and roleBindingName, which mapped the twelve, goes Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/normal.zig | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/normal.zig') diff --git a/src/normal.zig b/src/normal.zig index 986a8116..48bbe915 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -25,24 +25,6 @@ fn isPrefix(key: Key, cp: u21) bool { return key.cp == cp and !key.ctrl and !key.alt; } -fn roleBindingName(comptime role: modal.Normal.Role) []const u8 { - return switch (role) { - .prefix_goto => "goto_prefix", - .prefix_view => "view_prefix", - .prefix_view_sticky => "view_prefix_sticky", - .prefix_match => "match_prefix", - .prefix_find_fwd => "find_char_fwd", - .prefix_find_back => "find_char_back", - .prefix_till_fwd => "till_char_fwd", - .prefix_till_back => "till_char_back", - .prefix_replace => "replace_prefix", - .prefix_next => "next_prefix", - .prefix_prev => "prev_prefix", - .prefix_register => "register_prefix", - else => @tagName(role), - }; -} - fn normalInput(key: Key) modal.Normal.Input { var out: modal.Normal.Input = .{ .cp = key.cp, @@ -50,7 +32,7 @@ fn normalInput(key: Key) modal.Normal.Input { .alt = key.alt, }; inline for (std.enums.values(modal.Normal.Role)) |role| { - const name = comptime roleBindingName(role); + const name = @tagName(role); if (!@hasDecl(config, name)) @compileError("normal input role has no config binding: " ++ name); const binding = @field(config, name); -- cgit v1.3