From ea8e7ead2d587d2cd84b530dd4abb04e9626ba29 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 15 Nov 2025 16:25:24 +0800 Subject: [PATCH] :lipstick: Add go to previous path action in path nav in file list --- lib/widgets/file_list_view.dart | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/widgets/file_list_view.dart b/lib/widgets/file_list_view.dart index 114901e4..446306cc 100644 --- a/lib/widgets/file_list_view.dart +++ b/lib/widgets/file_list_view.dart @@ -374,13 +374,26 @@ class FileListView extends HookConsumerWidget { icon: Icon( mode.value == FileListMode.unindexed ? Symbols.inventory_2 + : currentPath.value != '/' + ? Symbols.arrow_back : Symbols.folder, ), onPressed: () { if (mode.value == FileListMode.unindexed) { mode.value = FileListMode.normal; + currentPath.value = '/'; + } else { + final pathParts = + currentPath.value + .split('/') + .where((part) => part.isNotEmpty) + .toList(); + if (pathParts.isNotEmpty) { + pathParts.removeLast(); + currentPath.value = + pathParts.isEmpty ? '/' : '/${pathParts.join('/')}'; + } } - currentPath.value = '/'; }, visualDensity: const VisualDensity( horizontal: -4,