Skip to content

Terminal doesn't scroll to the bottom when you type while scrolled up #37922

Open

Description

@joshka

Bug

When the terminal is scrolled up into its history, typing does not scroll it back to the bottom. The prompt, your input, and the command output all stay off screen. To see what you're typing, you have to reach for the mouse and scroll down first, so a keyboard-only workflow breaks.

Steps to reproduce

  1. Open a terminal in a thread and run something with enough output to scroll, e.g. seq 500.
  2. Scroll up into the history.
  3. Type a command and press Enter.

Expected: the view jumps to the bottom as soon as you type, like most terminals (xterm.js calls this scrollOnUserInput and enables it by default).

Actual: the view stays where it was. Your input and its output are hidden until you scroll down by hand.

Cause

The view only returns to the bottom on resize (ThreadTerminalDrawer.tsx) or from the context menu's "scroll to bottom" item. Key, text, composition and paste input in apps/web/src/terminal/ghostty/surface.ts call this.options.onData(...) directly and never touch the scroll position.

Suggested fix

Route user input through one helper that scrolls to the bottom first:

private sendUserInput(data: string): void {
  this.core.scrollToBottom();
  this.options.onData(data);
}

Use it for key, text, composition and paste input. Keep mouse reports, wheel-to-arrow data and terminal query replies on plain onData, since those shouldn't move the view.

🤖 Claude Opus 5.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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