feat: cleanup appstate, move sort to tab

This commit is contained in:
2025-05-26 17:22:23 +02:00
parent c4c901f1d4
commit 095b8659d6
9 changed files with 270 additions and 159 deletions

View File

@@ -1,11 +1,18 @@
pub fn handle_key(key: vaxis.Key, appState: *AppState, arena: std.mem.Allocator) !void {
pub fn handle_key(key: vaxis.Key, appState: *AppState, arena: std.mem.Allocator) !ActionResult {
if (key.matches(vaxis.Key.left, .{})) {
try handle_action(Action.GoUp, appState, arena);
return try handle_action(Action.GoUp, appState, arena);
} else if (key.matches(vaxis.Key.up, .{})) {
return try handle_action(Action.SelectPrevious, appState, arena);
} else if (key.matches(vaxis.Key.down, .{})) {
return try handle_action(Action.SelectNext, appState, arena);
}
return ActionResult.None;
}
const std = @import("std");
const vaxis = @import("vaxis");
const ActionResult = @import("../core/action/action.zig").ActionResult;
const handle_action = @import("../core/action/action_handler.zig").handle;
const Action = @import("../core/action/action.zig").Action;
const AppState = @import("../core/app_state.zig").AppState;