Skip to content

Make DECRQCRA opt-in (TerminalOptions.ChecksumReportsEnabled, default off) - #191

Merged
tomlm merged 2 commits into
tomlm:mainfrom
confetty-sh:stack/xterm-net-decrqcra-claude
Nov 9, 2026
Merged

tomlm merged 2 commits into
tomlm:mainfrom
confetty-sh:stack/xterm-net-decrqcra-claude

Conversation

@JohnCampionJr

Copy link
Copy Markdown
Collaborator

Fixes #190

Why

DECRQCRA (CSI Pid ; Pp ; Pt ; Pl ; Pb ; Pr * y) reports a checksum of a rectangle of the screen. Asked one cell at a time, the checksums spell out the text. That lets a program, or a remote host the user has just ssh'd to, read what was on screen before it started, including the alternate screen the last full-screen app left behind. WezTerm turned it off by default for this reason (wezterm/wezterm#7701), xterm gates it behind allowWindowOps (GetChecksum), iTerm2 shows a prompt first, and Ghostty doesn't implement it.

What changed

  • New TerminalOptions.ChecksumReportsEnabled, default false. It sits next to ClipboardReadEnabled, the other read-back gate, and is copied by the copy constructor.
  • RequestChecksumRectangularArea returns without replying when the option is off, after the existing VT400 level gate. "No reply" is what xterm and WezTerm send when it's disallowed, and a canned value could be mistaken for a real sum. With the option on, behaviour is unchanged.
  • Nothing advertises DECRQCRA on its own. The OSC 1337 Capabilities string has no checksum code, XTGETTCAP has no entry for it, and no DECRQM mode covers it. DA attribute 28 means rectangular editing in general (DECCRA, DECFRA and the rest), which is still supported, so it stays.
  • The README has a short "Behaviour changes" section.

Behaviour change / how to opt in

DECRQCRA now gets no reply unless a host turns it on. esctest reads every cell back through it, so a conformance run needs:

new Terminal(new TerminalOptions { ChecksumReportsEnabled = true });
// or on a running terminal (the option is read on each request):
terminal.Options.ChecksumReportsEnabled = true;

Tests

  • The existing DECRQCRA tests now turn the option on explicitly: ChecksumReportTests through its helper, DeviceReportTests.Decrqcra_IsSilentBelowLevel64, and VtTestBehaviourTests.Rectangular_area_checksums_negate_the_sum_of_the_characters.
  • New: Is_silent_by_default (no reply from a default terminal) and Is_silent_when_disabled_and_answers_once_enabled (no reply while off, the correct checksum after the option is turned on at runtime). Constructor_SetsDefaultValues asserts the default is off. The reflection-based Clone_CopiesEverySettableProperty covers the copy.
  • Checksum, device-report, vttest-behaviour and options tests: 82 passed, 0 failed.
  • Mutation check, 4 of 4 killed:
    • gate removed: killed by both new silence tests
    • default flipped to true: killed by Is_silent_by_default and Constructor_SetsDefaultValues
    • gate inverted: killed by the enable test and the existing checksum tests
    • copy-constructor line dropped: killed by Clone_CopiesEverySettableProperty and the checksum tests

🤖 Generated with Claude Code

@JohnCampionJr JohnCampionJr left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-merge review (Codex), for the PR author

No findings. Checked the default-off DECRQCRA gate, silence while disabled, runtime opt-in, VT-level ordering, cloning/copying and tests. The option and copy-constructor additions combine cleanly with the configurable word-separator PR. The combined core PRs build and pass 212 filtered tests, including checksum, device-report, terminal-options, selection, word-separator, OSC-terminator and text-sizing cases. No approval or merge action is being taken.

@tomlm
tomlm merged commit e4f7d12 into tomlm:main Nov 9, 2026
4 checks passed
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.

Suggest DECRQCRA should not be enabled without a prompt

2 participants