diff --git a/src/console/action_map.zig b/src/console/action_map.zig index 8ebf4fa..604cb77 100644 --- a/src/console/action_map.zig +++ b/src/console/action_map.zig @@ -1,6 +1,8 @@ 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.right, .{})) { + return try handle_action(Action.Enter, appState, arena); } else if (key.matches(vaxis.Key.up, .{})) { return try handle_action(Action.SelectPrevious, appState, arena); } else if (key.matches(vaxis.Key.down, .{})) { diff --git a/src/core/action/action_handler.zig b/src/core/action/action_handler.zig index 92b07b7..56f0c57 100644 --- a/src/core/action/action_handler.zig +++ b/src/core/action/action_handler.zig @@ -10,7 +10,13 @@ pub fn handle(action: Action, appState: *AppState, arena: std.mem.Allocator) !Ac } else return error.NoParent; } else return error.NoCurrentLocation; }, - .Enter => {}, + .Enter => { + if (appState.currentTab.currentItem) |currentItem| { + const path = try arena.dupe(u8, currentItem.path); + try appState.currentTab.setCurrentLocation(.{ .path = path }); + return ActionResult.Handled; + } else return error.NoCurrentLocation; + }, .SelectNext => { return selectNextIndex(appState.currentTab, .Next); },