fix: widen safeFit parameter from ManagedPaneInternal to ManagedPane

The mobile-fit-override code calls safeFit with ManagedPane (from
getPanes()), but safeFit was typed to require ManagedPaneInternal.
Widen the parameter type since safeFit only needs fields on ManagedPane.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo-H
2026-04-30 18:03:54 -04:00
co-authored by Orca
parent 78b3069bec
commit e7d1bdaddd
3 changed files with 12 additions and 7 deletions
@@ -1,4 +1,4 @@
import type { DropZone, ManagedPaneInternal } from './pane-manager-types'
import type { DropZone, ManagedPane, ManagedPaneInternal } from './pane-manager-types'
import type { PaneStyleOptions } from './pane-manager-types'
import { detachPaneFromTree, insertPaneNextTo } from './pane-tree-ops'
@@ -17,7 +17,7 @@ export type DragReorderCallbacks = {
getRoot: () => HTMLElement
getStyleOptions: () => PaneStyleOptions
isDestroyed: () => boolean
safeFit: (pane: ManagedPaneInternal) => void
safeFit: (pane: ManagedPane) => void
applyPaneOpacity: () => void
applyDividerStyles: () => void
refitPanesUnder: (el: HTMLElement) => void
@@ -379,7 +379,7 @@ export class PaneManager {
getRoot: () => this.root,
getStyleOptions: () => this.styleOptions,
isDestroyed: () => this.destroyed,
safeFit: (pane: ManagedPaneInternal) => safeFit(pane),
safeFit,
applyPaneOpacity: () =>
applyPaneOpacity(this.panes.values(), this.activePaneId, this.styleOptions),
applyDividerStyles: () => this.applyDividerStylesWrapped(),
@@ -1,4 +1,9 @@
import type { DropZone, ManagedPaneInternal, PaneStyleOptions } from './pane-manager-types'
import type {
DropZone,
ManagedPane,
ManagedPaneInternal,
PaneStyleOptions
} from './pane-manager-types'
import { createDivider } from './pane-divider'
import { getFitOverrideForPane } from './mobile-fit-overrides'
@@ -11,12 +16,12 @@ export { findLineByContent, captureScrollState, restoreScrollState } from './pan
type TreeOpsCallbacks = {
getRoot: () => HTMLElement
getStyleOptions: () => PaneStyleOptions
safeFit: (pane: ManagedPaneInternal) => void
safeFit: (pane: ManagedPane) => void
refitPanesUnder: (el: HTMLElement) => void
onLayoutChanged?: () => void
}
function getProposedDimensions(pane: ManagedPaneInternal): { cols: number; rows: number } | null {
function getProposedDimensions(pane: ManagedPane): { cols: number; rows: number } | null {
try {
return pane.fitAddon.proposeDimensions() ?? null
} catch {
@@ -34,7 +39,7 @@ function getProposedDimensions(pane: ManagedPaneInternal): { cols: number; rows:
// scrollTop to 0 asynchronously. splitPane captures the pre-split state and
// scheduleSplitScrollRestore owns the authoritative restore on a timer, so
// safeFit here just fits and lets the scheduled restore do its job.
export function safeFit(pane: ManagedPaneInternal): void {
export function safeFit(pane: ManagedPane): void {
try {
// Why: when a mobile client has resized this PTY to phone dimensions,
// the desktop must keep xterm at those dimensions instead of fitting to