feat: enter
This commit is contained in:
@@ -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, .{})) {
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user