Skip to content

[Bug]: Terminal drawer does not re-fit when its container is resized #4842

Description

@leftytennis

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a thread and open the terminal drawer.
  2. Run something that fills the width, e.g. ls -la or any command with wide output.
  3. Resize the drawer (drag its divider), or resize the surrounding panel/window so the drawer's container changes size.

Expected behavior

The terminal re-fits to its new container size: columns and rows recompute, output reflows to the new width, and the PTY is told about the new dimensions.

Actual behavior

The terminal keeps the dimensions it was given at mount. Output stays wrapped to the old column count, so it looks truncated or wrapped at the wrong width, and the PTY continues to believe the terminal is the original size.

In apps/web/src/components/ThreadTerminalDrawer.tsx, TerminalViewport fits the terminal exactly once, from a setTimeout(..., 30) after mount:

const fitTimer = window.setTimeout(() => {
  // ...
  fitTerminalSafely(activeFitAddon);
  void resizeTerminal(activeTerminal.cols, activeTerminal.rows);
}, 30);

There is a MutationObserver watching class/style, but nothing observes the container's size, so a resize that does not change those attributes (dragging the divider, window resize, layout reflow) never triggers a re-fit.

Impact

Minor bug or occasional failure

Version or commit

main @ 49c0d96

Environment

macOS 26.5.2 (Darwin 25.5.0), Node v24.18.0, desktop app

Workaround

Close and reopen the terminal drawer after resizing — the remount re-runs the one-shot fit at the new size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions