Skip to content

v1.4.4 bug fix

Choose a tag to compare

@MrOrangeJJ MrOrangeJJ released this 04 Jun 04:58
· 103 commits to main since this release

v1.4.4 Release Notes

English

v1.4.4 is a focused reliability release for terminal sizing — primarily a Windows fix. On some platforms (notably Windows) the renderer can emit a terminal resize before the PTY or SSH shell is actually ready, which is exactly when the old code dropped the new size on the floor. The result was terminals that opened at a stale or default geometry (e.g. 80×24) and stayed wrong until you manually nudged the window. This release makes resize requests survive that race in both the local terminal service and the SSH backend, and normalizes fractional/invalid sizes consistently along the way.

Highlights You Will Notice

  • Terminals open at the correct size, even when resize arrives first
    • the renderer can fire a resize before a terminal is registered (the PTY/SSH session hasn't finished spawning yet). That early size is now cached in a pendingResizeByTerminal map instead of being discarded
    • when the terminal is then created, the cached size is folded into the spawn geometry — so the backend PTY/SSH shell is opened at the real dimensions instead of a stale default, and the terminal inventory reports the correct cols/rows immediately
    • if the resize arrives after spawn but before the tab is wired up, it is still applied to the freshly spawned backend, so nothing is lost in either ordering
    • the pending-resize cache is cleaned up alongside the terminal on kill and on session teardown, so a stale pending size can never leak into a later terminal that happens to reuse the same id
  • Remount / dev-reload no longer leaves the backend at the old size
    • createTerminal is idempotent (the renderer may call it more than once on remount or hot reload). Previously a re-create updated the in-memory tab size but didn't always push the change down to the backend PTY
    • now, when an idempotent re-create changes the size (or a pending resize was waiting), the backend is explicitly resized so the underlying PTY matches what the UI thinks it is
  • SSH window size survives the shell-open race
    • the SSH backend now tracks the latest requested window size (requestedCols / requestedRows) independently of the live stream
    • a resize that arrives before the interactive shell stream exists no longer no-ops — the size is cached, and applied via setWindow the moment the stream attaches
    • the initial client.shell(...) request now opens with the latest requested window size rather than the possibly-stale config size, so the very first screen is already correctly sized
    • SSH setWindow calls are now wrapped so a transient failure can't throw; the requested size stays cached and is re-applied on the next resize
  • Consistent, defensive size normalization
    • both the terminal service and the SSH backend now run incoming cols/rows through the same normalization: non-finite or non-positive values are rejected, and fractional values (e.g. 132.9 × 43.8) are floored and clamped to at least 1 × 1 (SSH falls back to 80 × 24 when nothing valid is available)
    • this prevents partial/garbage geometry from reaching the PTY layer and keeps the cached, spawn-time, and live sizes in agreement

中文

v1.4.4 是一次聚焦于终端尺寸可靠性的修复版本——主要面向 Windows。在某些平台(尤其是 Windows)上,渲染层可能在 PTY 或 SSH shell 真正就绪之前就发出终端 resize,而旧逻辑恰好会在这个时机把新尺寸丢弃。结果就是终端以一个陈旧或默认的尺寸(例如 80×24)打开,并一直保持错误,直到你手动拖动窗口才会纠正。本次更新让 resize 请求在本地终端服务和 SSH 后端两侧都能扛过这个竞态,并在过程中对小数 / 非法尺寸做了一致的规范化处理。

你会直接感知到的升级

  • 即使 resize 先于终端创建到达,终端也会以正确尺寸打开
    • 渲染层可能在终端注册完成之前就触发 resize(此时 PTY/SSH 会话还没 spawn 完)。这个提前到达的尺寸现在会被缓存进 pendingResizeByTerminal,而不是被直接丢掉
    • 当终端随后被创建时,缓存的尺寸会被并入 spawn 的几何参数——后端 PTY/SSH shell 会以真实尺寸打开,而不是陈旧的默认值,终端清单也会立即上报正确的 cols/rows
    • 如果 resize 是在 spawn 之后、tab 接线之前到达的,它仍会被应用到刚 spawn 出来的后端,因此无论哪种时序都不会丢失尺寸
    • pending-resize 缓存会随着终端在 kill 和会话拆除时一并清理,避免某个陈旧的待应用尺寸泄漏到之后复用同一 id 的终端上
  • 重新挂载 / 开发热重载不再让后端停留在旧尺寸
    • createTerminal 是幂等的(渲染层在重新挂载或热重载时可能多次调用)。以前重新创建会更新内存中 tab 的尺寸,但不总是把变化下发到后端 PTY
    • 现在,当幂等的重新创建改变了尺寸(或有一个 pending resize 在等待)时,会显式 resize 后端,让底层 PTY 与 UI 认为的尺寸保持一致
  • SSH 窗口尺寸能扛过 shell 打开的竞态
    • SSH 后端现在会独立于实时 stream,单独跟踪最新请求的窗口尺寸(requestedCols / requestedRows)
    • 在交互式 shell stream 还不存在时到达的 resize 不再是空操作——尺寸会被缓存,并在 stream 接入的那一刻通过 setWindow 应用
    • 初始的 client.shell(...) 请求现在会以最新请求的窗口尺寸打开,而不是可能已陈旧的 config 尺寸,因此第一屏就已经是正确尺寸
    • SSH 的 setWindow 调用现在被包裹起来,临时性失败不会抛出异常;请求的尺寸会保持缓存,并在下一次 resize 时重新应用
  • 一致且具防御性的尺寸规范化
    • 终端服务和 SSH 后端现在都会用同一套规范化处理传入的 cols/rows:非有限值或非正值会被拒绝,小数值(例如 132.9 × 43.8)会被向下取整并钳制到至少 1 × 1(SSH 在没有任何有效值时回退到 80 × 24)
    • 这避免了残缺 / 垃圾几何参数到达 PTY 层,并让缓存尺寸、spawn 时尺寸和实时尺寸保持一致