terminal: fix posix_spawnp failure (spawn-helper exec bit), half-viewport default, fullscreen toggle, middle-click close
- Root cause of the endless 'disconnected, reconnecting' banner: pnpm strips the executable bit from node-pty's prebuilt spawn-helper, so every spawn failed with posix_spawnp failed and the client retried forever. ensureSpawnHelper() restores 0755 at plugin activation (mirrors dsh-pty-local's postinstall; works for link installs too). Verified against the live GUI: terminal now connects and echoes. - TerminalView stops auto-reconnecting on a server refusal (close 1011 with a reason): shows the reason plus a manual retry instead of spinning. - defaultShell() also guards an empty SHELL. - New sessions open at half the viewport width; width clamping now allows filling the window, and a header fullscreen button expands the sidebar to the full viewport (toggle restores half). - Middle-click on a tab closes it (auxclick button 1, autoscroll suppressed). - Tests: +2 (shell fallback, spawn-helper exec bit idempotent).
This commit is contained in:
1 parent
58b4bd71ba
commit
c7a7c7e5af
10 files changed
+160
-14
No files matched your search
+12
-6
@@ -64,14 +64,16 @@ function uid(prefix: string): string {
|
||||
return `${prefix}:${nextIdCounter}`
|
||||
}
|
||||
|
||||
/** A fresh default state: open, default width, one explorer tab in one pane. */
|
||||
export function makeDefaultState(): SidebarState {
|
||||
/** A fresh default state: open, one explorer tab in one pane. `width` is
|
||||
* the caller's preferred panel width (default PANEL_DEFAULT); the store
|
||||
* seeds new sessions with half the viewport. */
|
||||
export function makeDefaultState(width = PANEL_DEFAULT): SidebarState {
|
||||
const leaf: SidebarLeaf = { kind: 'leaf', id: uid('pane'), tabs: [], active: null }
|
||||
leaf.tabs = [{ id: uid('tab'), type: 'explorer', title: 'Explorer' }]
|
||||
leaf.active = leaf.tabs[0]!.id
|
||||
return {
|
||||
panelOpen: true,
|
||||
width: PANEL_DEFAULT,
|
||||
width,
|
||||
activePane: leaf.id,
|
||||
nextTerminal: 1,
|
||||
expanded: [],
|
||||
@@ -315,9 +317,11 @@ export function togglePanel(state: SidebarState): SidebarState {
|
||||
return { ...state, panelOpen: !state.panelOpen }
|
||||
}
|
||||
|
||||
/** Set the panel width (clamped to the contract range). */
|
||||
/** Set the panel width (clamped to the contract range; the upper bound is
|
||||
* the viewport so the fullscreen expansion can fill the window). */
|
||||
export function setWidth(state: SidebarState, width: number): SidebarState {
|
||||
return { ...state, width: Math.min(PANEL_MAX, Math.max(PANEL_MIN, Math.round(width))) }
|
||||
const max = typeof window !== 'undefined' ? Math.max(PANEL_MIN, window.innerWidth) : PANEL_MAX
|
||||
return { ...state, width: Math.min(max, Math.max(PANEL_MIN, Math.round(width))) }
|
||||
}
|
||||
|
||||
/** Toggle a directory in the explorer expansion set. */
|
||||
@@ -368,7 +372,9 @@ function loadState(sessionId: string): SidebarState {
|
||||
} catch {
|
||||
// Corrupt or unavailable storage: fall through to the default.
|
||||
}
|
||||
return makeDefaultState()
|
||||
// New sessions open at half the viewport (VSCode-like default split).
|
||||
const half = typeof window !== 'undefined' ? Math.max(PANEL_MIN, Math.round(window.innerWidth / 2)) : PANEL_DEFAULT
|
||||
return makeDefaultState(half)
|
||||
}
|
||||
|
||||
/** The session-scoped store: one state per conversation, localStorage-backed. */
|
||||
|
||||
Reference in new issue
Block a user