fix(ui): leave the file manager after a drive hop instead of replaying hops (#2567)

Back replays the history stack, so a round trip between drives leaves one
entry per hop: internal storage, Linux, internal storage, then Back lands
on Linux again and leaving takes one press per hop. Two roots in a row
means the user hopped rather than descended into a folder, so Back leaves
instead. Returning to a folder from a drive root still works as before.

Co-authored-by: Dantalian <Dantalian-dev@users.noreply.github.com>
This commit is contained in:
DantalianandDantalian authored and GitHub committed 2026-11-15 09:35:10 -05:00
1 parent 9ce6d45be8
commit 52e8028609
2 files changed
+18 -2

No files matched your search

@@ -17,4 +17,14 @@ class FileManagerNavigationTest {
assertTrue(canNavigateUp(child, drive))
assertFalse(canNavigateUp(drive, drive))
}
@Test fun backLeavesInsteadOfHoppingBetweenTwoRoots() {
val drive = tmp.newFolder("drive")
val other = tmp.newFolder("other")
val child = File(drive, "folder").apply { mkdir() }
assertTrue(backExitsAtRootHop(drive, drive, other to other))
assertFalse(backExitsAtRootHop(drive, drive, child to other))
assertFalse(backExitsAtRootHop(child, drive, other to other))
}
}