Compare commits

..

1 Commits

Author SHA1 Message Date
Shantur Rathore
ab3f228d85 fix(ui): handle Windows paths in tab titles 2026-02-12 14:57:40 +00:00

View File

@@ -11,20 +11,11 @@ interface InstanceTabProps {
onClose: () => void onClose: () => void
} }
function formatFolderName(path: string, instances: Instance[], currentInstance: Instance): string { function getPathBasename(path: string): string {
const name = path.split("/").pop() || path // Instance folders can be POSIX-like (/Users/...) on macOS/Linux or Windows-like (C:\Users\...).
// Normalize by trimming trailing separators and then splitting on both '/' and '\\'.
const duplicates = instances.filter((i) => { const normalized = path.replace(/[\\/]+$/, "")
const iName = i.folder.split("/").pop() || i.folder return normalized.split(/[\\/]/).pop() || path
return iName === name
})
if (duplicates.length > 1) {
const index = duplicates.findIndex((i) => i.id === currentInstance.id)
return `~/${name} (${index + 1})`
}
return `~/${name}`
} }
const InstanceTab: Component<InstanceTabProps> = (props) => { const InstanceTab: Component<InstanceTabProps> = (props) => {
@@ -58,7 +49,7 @@ const InstanceTab: Component<InstanceTabProps> = (props) => {
> >
<FolderOpen class="w-4 h-4 flex-shrink-0" /> <FolderOpen class="w-4 h-4 flex-shrink-0" />
<span class="tab-label"> <span class="tab-label">
{props.instance.folder.split("/").pop() || props.instance.folder} {getPathBasename(props.instance.folder)}
</span> </span>
<span <span
class={`status-indicator session-status ml-auto ${statusClassName()}`} class={`status-indicator session-status ml-auto ${statusClassName()}`}