@brimveyn/aimux 1.14.5 → 1.14.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app-runtime/use-terminal-resize.ts +12 -0
- package/src/app.tsx +19 -10
package/package.json
CHANGED
|
@@ -165,6 +165,18 @@ export function useTerminalResize({
|
|
|
165
165
|
// loop so an unchanged box never re-triggers a resize.
|
|
166
166
|
const measuredRef = useRef(new Map<string, { cols: number; rows: number }>())
|
|
167
167
|
|
|
168
|
+
// Drop the dedupe cache when the workspace changes. attach() re-gates every
|
|
169
|
+
// restored tab's paneReady to false; if a tabId carries the same dimensions
|
|
170
|
+
// across workspaces, handleMeasure's prev-match would short-circuit and
|
|
171
|
+
// never call resizeTab({confirmedFromMeasurement:true}), leaving the gate
|
|
172
|
+
// closed forever — the new pane then paints a stale buffered snapshot from
|
|
173
|
+
// the old workspace, which is the 2–3 row offset users see.
|
|
174
|
+
const lastSessionIdRef = useRef(state.currentSessionId)
|
|
175
|
+
if (lastSessionIdRef.current !== state.currentSessionId) {
|
|
176
|
+
lastSessionIdRef.current = state.currentSessionId
|
|
177
|
+
measuredRef.current.clear()
|
|
178
|
+
}
|
|
179
|
+
|
|
168
180
|
// Closed measurement loop: the rendered terminal content box reports its
|
|
169
181
|
// real geometry; that — not the hardcoded chrome model below — is the
|
|
170
182
|
// authority for the PTY/xterm size and the mouse-mapping origin. The model
|
package/src/app.tsx
CHANGED
|
@@ -247,8 +247,14 @@ export function App({
|
|
|
247
247
|
}, [])
|
|
248
248
|
|
|
249
249
|
const resizingRef = useRef(false)
|
|
250
|
+
// Seeded with state.layout's DEFAULT 80x24; reassigned below once
|
|
251
|
+
// useTerminalResize has produced the open-loop estimate from real dimensions.
|
|
252
|
+
// Reading state.layout here is wrong: on the first render state.layout is
|
|
253
|
+
// still the bootstrap default, and useBackendRuntime's attach effect would
|
|
254
|
+
// then hand 80x24 to the backend, resizing the daemon-persisted PTYs (or
|
|
255
|
+
// newly-spawned ones) to the wrong size and stranding the assistant's
|
|
256
|
+
// already-drawn content in the top-left until a workspace switch.
|
|
250
257
|
const layoutRef = useRef(state.layout)
|
|
251
|
-
layoutRef.current = state.layout
|
|
252
258
|
const activeTab = useMemo(
|
|
253
259
|
() => state.tabs.find((tab) => tab.id === state.activeTabId),
|
|
254
260
|
[state.activeTabId, state.tabs]
|
|
@@ -282,6 +288,18 @@ export function App({
|
|
|
282
288
|
const contentOriginRef = useRef<TerminalContentOrigin>({ cols: 0, rows: 0, x: 0, y: 0 })
|
|
283
289
|
const currentSessionWorkspaceSnapshot = currentSession?.workspaceSnapshot
|
|
284
290
|
|
|
291
|
+
// Must run before useBackendRuntime so its open-loop terminalSize seeds
|
|
292
|
+
// layoutRef before the attach effect reads it. See the comment on layoutRef.
|
|
293
|
+
const terminalSize = useTerminalResize({
|
|
294
|
+
backend,
|
|
295
|
+
contentOriginRef,
|
|
296
|
+
dimensions,
|
|
297
|
+
dispatch,
|
|
298
|
+
resizingRef,
|
|
299
|
+
state,
|
|
300
|
+
})
|
|
301
|
+
layoutRef.current = { terminalCols: terminalSize.cols, terminalRows: terminalSize.rows }
|
|
302
|
+
|
|
285
303
|
const syntaxOverlayFlag = resolvedConfig.theme?.beta?.experimentalSyntaxHighlight === true
|
|
286
304
|
const syntaxOverlayFlagRef = useRef(syntaxOverlayFlag)
|
|
287
305
|
syntaxOverlayFlagRef.current = syntaxOverlayFlag
|
|
@@ -334,15 +352,6 @@ export function App({
|
|
|
334
352
|
stateRef,
|
|
335
353
|
})
|
|
336
354
|
|
|
337
|
-
const terminalSize = useTerminalResize({
|
|
338
|
-
backend,
|
|
339
|
-
contentOriginRef,
|
|
340
|
-
dimensions,
|
|
341
|
-
dispatch,
|
|
342
|
-
resizingRef,
|
|
343
|
-
state,
|
|
344
|
-
})
|
|
345
|
-
|
|
346
355
|
const {
|
|
347
356
|
handleEmbeddedGitResizeStart,
|
|
348
357
|
handleGitPaneResizeStart,
|