diff --git a/EXPLORER.md b/EXPLORER.md index 4fac309..275de56 100644 --- a/EXPLORER.md +++ b/EXPLORER.md @@ -208,18 +208,19 @@ absence the signal. Back with unsaved changes asks, and says the edits will be lost. The explorer draws over the session, which deliberately has no `imePadding`, so the explorer's own box adds it. -### 10. The explorer draws over the session, and the two back controls differ +### 10. The explorer draws over the session, and back follows what is open `Screen.Session` in `AppRoot` gains a `files: FilesTarget?`. When set, the `FilesScreen` is composed **on top of** the session in the same `Box`, and the session stays composed under it: its event stream keeps flowing, its scroll position and draft stay where they were, and returning from a file -costs nothing. The header's back button clears `files` and returns directly to -the session. Android back returns from an open file to its containing directory, -then walks to the parent directory until the root; at the root it returns to the -session. The `..` row remains as the visible, tappable form of the same directory -movement. An editor with unsaved changes asks before either route discards them. -"Back returns; it does not exit." +costs nothing. From an open file, both the header's back button and Android back +return to its containing directory. From a directory, the header's back button +clears `files` and returns to the session, while Android back walks to the parent +directory until the root and only then returns to the session. The `..` row +remains as the visible, tappable form of the same directory movement. An editor +with unsaved changes asks before either route discards them. "Back returns; it +does not exit." Rejected: a `Screen.Files` beside `Screen.Session`. Every route back from a leaf screen goes to Main today, and a session disposed and re-created on each diff --git a/app/androidApp/src/main/kotlin/com/example/aiapp/FilesScreen.kt b/app/androidApp/src/main/kotlin/com/example/aiapp/FilesScreen.kt index 5a76caf..eda917e 100644 --- a/app/androidApp/src/main/kotlin/com/example/aiapp/FilesScreen.kt +++ b/app/androidApp/src/main/kotlin/com/example/aiapp/FilesScreen.kt @@ -81,9 +81,9 @@ private enum class UnsavedDestination { * The files on the machine a session runs on: browse them, read one, change one. * * Drawn **over** the session rather than instead of it (see [AppRoot]), so its event stream keeps - * flowing and coming back from a file costs nothing. Android back returns from a file to its - * directory, then walks up the directory tree. The header's back button closes the explorer and - * returns directly to the session. + * flowing and coming back from a file costs nothing. Both back controls return from a file to its + * directory. In a directory, Android back walks up the directory tree while the header's back + * button closes the explorer and returns to the session. * * Every directory that has been visited is kept for as long as this is open; the refresh glyph is * how one gets asked again on purpose, and creating something refetches the directory it was @@ -194,7 +194,7 @@ fun FilesScreen(settings: ServerSettings, target: FilesTarget, onClose: () -> Un editing = editing, onEditing = { editing = it }, onDirty = { dirty = it }, - onBack = { leave(UnsavedDestination.Session) }, + onBack = { leave(UnsavedDestination.Directory) }, ) } }