feat: things

This commit is contained in:
2025-05-23 13:33:10 +02:00
parent cbeed4003a
commit 33d8306f22
9 changed files with 59 additions and 43 deletions

View File

@@ -1,10 +1,11 @@
pub fn handle(action: Action, appState: *AppState) !void {
pub fn handle(action: Action, appState: *AppState, arena: std.mem.Allocator) !void {
switch (action) {
.GoUp => {
if (appState.currentTab.currentLocation) |currentLocation| {
const parent = currentLocation.item.parent;
if (parent) |p| {
try appState.currentTab.setCurrentLocation(.{ .path = p.path.path });
const path = try arena.dupe(u8, p.path.path);
try appState.currentTab.setCurrentLocation(.{ .path = path });
} else return error.NoParent;
} else return error.NoCurrentLocation;
},
@@ -12,6 +13,7 @@ pub fn handle(action: Action, appState: *AppState) !void {
}
}
const std = @import("std");
const Action = @import("action.zig").Action;
const AppState = @import("../app_state.zig").AppState;
const RootProvider = @import("../provider/root.zig").RootProvider;