This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-08 22:07:47 +09:00
1 parent d903b4ac03
commit 241c8c0e47
2 files changed
+22 -12

No files matched your search

+3 -1
View File
@@ -1788,7 +1788,9 @@
if (tab.kind === 'files')
updateViewTab(owner, tab.id, {
directory: view.directory,
label: view.directory?.split('/').filter(Boolean).pop() || $i18n.t('Files')
label: view.isHome
? $i18n.t('Home')
: view.directory?.split('/').filter(Boolean).pop() || $i18n.t('Files')
});
}}
onFilesMoved={() => {
+19 -11
View File
@@ -81,17 +81,23 @@
export let onViewChange: ((view: any) => void) | null = null;
export let onFileSaved: ((content: string) => void) | null = null;
let viewRestored = !initialView;
export const captureView = () =>
!viewRestored && initialView
? initialView
: {
directory: currentPath,
selectedFile,
expanded: [...expandedDirs],
preview: (commentPreviewRef ?? filePreviewRef)?.captureView(),
dirty: dirty || saving,
scrollTop: viewerRoot?.scrollTop ?? 0
};
export const captureView = () => {
const view =
!viewRestored && initialView
? initialView
: {
directory: currentPath,
selectedFile,
expanded: [...expandedDirs],
preview: (commentPreviewRef ?? filePreviewRef)?.captureView(),
dirty: dirty || saving,
scrollTop: viewerRoot?.scrollTop ?? 0
};
return {
...view,
isHome: homeDirectory !== null && asDirectoryPath(view.directory) === homeDirectory
};
};
const restoreView = async () => {
if (disposed || viewRestored || !initialView) return;
const view = initialView;
@@ -431,6 +437,7 @@
// Directory state
let currentPath = savedPath;
let homeDirectory: string | null = null;
let fileRoot: TerminalFileRoot | null = savedFileRoot;
let entries: FileEntry[] = [];
let currentWritable = true;
@@ -1109,6 +1116,7 @@
};
const applyCwd = (cwd: TerminalCwd | null) => {
homeDirectory = cwd?.home ? asDirectoryPath(cwd.home) : null;
const cwdPath = cwd?.cwd ? asDirectoryPath(cwd.cwd) : null;
setFileRoot(rootFromCwd(cwd));
const path = cwdPath ?? fileRoot?.path ?? '/';