20 lines
888 B
Zig
20 lines
888 B
Zig
pub fn handle_key(key: vaxis.Key, appState: *AppState, arena: std.mem.Allocator) !ActionResult {
|
|
if (key.matches(vaxis.Key.left, .{})) {
|
|
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;
|
|
const RootProvider = @import("../core/provider/root.zig").RootProvider;
|