Open transcript file links in explorer

This commit is contained in:
iris committed 2026-09-10 18:08:05 -04:00
1 parent 3c6e6778fd
commit e3cca97cdd
6 files changed
+137 -20

No files matched your search

@@ -48,7 +48,22 @@ import kotlinx.coroutines.withContext
* where it was working. That is what makes a second way in -- from the setups tab -- one more
* caller rather than any new code here.
*/
data class FilesTarget(val setup: String, val setupName: String, val start: String)
data class FilesTarget(
val setup: String,
val setupName: String,
val start: String,
/** A document to open immediately; [start] remains the fallback directory. */
val file: String? = null,
)
/** The explorer target for this session's machine, optionally opened on [file]. */
fun SessionSummary.filesTarget(file: String? = null) =
FilesTarget(
setup = setup,
setupName = setupName,
start = cwd?.takeIf { it.isNotBlank() } ?: "~",
file = file,
)
/** Where the explorer is: in a directory, or in one file. */
private sealed class Spot(val path: String) {
@@ -72,7 +87,14 @@ private sealed class Spot(val path: String) {
@Composable
fun FilesScreen(settings: ServerSettings, target: FilesTarget, onClose: () -> Unit) {
val scope = rememberCoroutineScope()
var here by remember { mutableStateOf<Spot>(Spot.Dir(target.start)) }
val initialDirectory =
target.file?.let(::parentOf)?.let { Spot.Dir(it) } ?: Spot.Dir(target.start)
var here by
remember(target) {
mutableStateOf<Spot>(
target.file?.let { Spot.Doc(it, initialDirectory) } ?: initialDirectory
)
}
val listings = remember { mutableStateMapOf<String, LoadState<Listing>>() }
var creating by remember { mutableStateOf(false) }
// Edit mode and whether anything has been typed live here rather than in the pane below,