Skip to content

Fix viewport staying pinned to the top after ESC[3J clears the scrollback - #6081

Merged
Tyriar merged 1 commit into
xtermjs:masterfrom
tarann26:fix/ed3-user-scrolling
Aug 10, 2026
Merged

Tyriar merged 1 commit into
xtermjs:masterfrom
tarann26:fix/ed3-user-scrolling

Conversation

@tarann26

Copy link
Copy Markdown
Contributor

Fixes #6046.

ESC[3J trims the scrollback and pulls ybase/ydisp down to 0 but left isUserScrolling set, so BufferService.scroll() kept refusing to advance ydisp and the viewport stayed at the top instead of following new output.

The reset is gated on the normal buffer being active, since isUserScrolling tracks the normal buffer's viewport and clearing it from the alt screen would drop the user's scroll position on return. scrollBackSize > 0 isn't a safe proxy for that on its own: Buffer.resize() skips the maxLength reduction while lines.length === 0, so a row shrink taken outside the alt screen leaves the alt buffer with a stale maxLength.

@Tyriar Tyriar added this to the 7.0.0 milestone Aug 10, 2026
@Tyriar
Tyriar enabled auto-merge (squash) August 10, 2026 11:34
@Tyriar
Tyriar merged commit d6cfe3d into xtermjs:master Aug 10, 2026
12 checks passed
srid added a commit to juspay/kolu that referenced this pull request Aug 20, 2026
Bump the terminal engine from **`@xterm/xterm@6.1.0-beta.300` /
`@xterm/addon-webgl@0.20.0-beta.297`** to the latest published betas —
**`6.1.0-beta.302` / `0.20.0-beta.298`** — and take the Code tab's diff
viewer from **`@pierre/diffs@1.2.12` to `1.3.5`**.

kolu rides the xterm 6.1 beta line via `pnpm.overrides` (stable latest
is still 6.0.0). Other addons and `@xterm/headless` stay on their
package ranges, same as the previous bump (#2130). `@pierre/trees` is
already on `1.0.0-beta.6`, its latest tag, so it does not move. Edit
mode from Pierre 1.3 is not adopted.

### What's new in xterm.js (since beta.300)

| Upstream | What it does for tiles |
| --- | --- |
| [xtermjs#6081](xtermjs/xterm.js#6081) | After
a program clears scrollback with **`ESC[3J`**, the viewport **follows
new output** instead of staying pinned to the empty top of the buffer
(`isUserScrolling` was left set, so `BufferService.scroll()` refused to
advance). |

beta.301 is CI-only (release-workflow permissions). WebGL addon
**297→298** is that same CI commit; pin it as the live `beta` tag,
independently of xterm's suffix.

### What's new in Pierre Diffs (1.2.12 → 1.3.5)

The Code tab's vanilla `CodeView` / `FileTree` wrappers compile
unchanged. What the viewer picks up:

- Syntax highlighting no longer races the worker pool on first open
([pierre#911](pierrecomputer/pierre#911))
- Virtualized rows no longer flash a previous file's header as you
scroll ([pierre#740](pierrecomputer/pierre#740))
- Expanding collapsed diff context, and live-updating a diff that's
already on screen, both work as they should
([pierre#861](pierrecomputer/pierre#861),
[pierre#881](pierrecomputer/pierre#881))
- The viewport keeps its place when a file drops out of a multi-file
view
([pierre#1047](pierrecomputer/pierre#1047));
resize handling is hardened
([pierre#1054](pierrecomputer/pierre#1054))

### This change

- `pnpm.overrides`: xterm **300→302**, addon-webgl **297→298** (matched
pair of latest betas)
- `@pierre/diffs` declared range **^1.2.12 → ^1.3.5**
- Refresh `fetchPnpmDeps` hash in `nix/workspace.nix`
- Changelog: edit the unreleased xterm note; add a Code-tab Pierre note
- `@kolu/xterm-kit` contract suites 94/94 and `@kolu/solid-pierre` 45/45
green on the new pins; typecheck of xterm-kit, solid-pierre, and
kolu-client exits 0

### Try it locally

```sh
nix run github:juspay/kolu/chore/deps-xterm-pierre
```

_Generated by Grok Build (model `grok-4.6`)._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESC[3J leaves the viewport pinned to the top after clearing scrollback

2 participants