diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:08:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:16:28 -0300 |
| commit | 090e9acdb744fdb8d6c7efcee41da74fcf7c542c (patch) | |
| tree | 4cebd7d1151bb7e2e878faa6ccb46b325c3bac9c /src/normal.zig | |
| parent | a6554511da894afb91169fce9af84511b5e60504 (diff) | |
| download | pardes-090e9acdb744fdb8d6c7efcee41da74fcf7c542c.tar.gz pardes-090e9acdb744fdb8d6c7efcee41da74fcf7c542c.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/normal.zig')
| -rw-r--r-- | src/normal.zig | 20 |
1 files changed, 1 insertions, 19 deletions
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); |
