Skip to content

[term-state] DECSTBM accepts top == bottom, which xterm and ghostty reject #3261

Closed

Description

@Xuepoo

Priority: P2 | Area: term | Labels: fix,P2,area:term | Milestone: v0.1.0 | RFC: none | Task: none

Problem

set_scroll_region accepts DECSTBM with top == bottom (a one-row region). xterm and ghostty reject it: the parameter pair is invalid when the top margin is not strictly above the bottom margin, and the sequence is ignored wholesale.

Bitty currently honours it, which produces a one-row scroll region — a state no reference terminal would enter, and the shape that makes a leaked margin look catastrophic (a whole pane reduced to a single scrolling row).

Fix

Reject top == bottom in set_scroll_region, keeping the existing "invalid requests are ignored wholesale" behaviour for top > bottom. Add a regression test for both rejected shapes and one for the accepted boundary (top + 1 == bottom), and check whether any existing test or fixture depends on the one-row region.

Context

Found while fixing #3259 (per-screen scroll margins, divergence D-1). The reproductions for that fix originally used CSI 1;1r, which no reference terminal accepts; they now use a five-row region. Tracked separately so the compatibility change is reviewable on its own.

Activity

  1. added this to the v0.1.0 milestone on Nov 19, 2026
  2. added
    fix
    area:term
    P2
    on Nov 19, 2026
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

    P2area:termfix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions