From 85cdc845fa663d1fa0e1265393b5d28398cd17ef Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Wed, 25 Nov 2026 23:45:06 +0000 Subject: [PATCH] Terminal fixture: opt-in emulator attribute showcase ?terminalAttrs=1 prints colon-form SGR, underline styles, strikethrough, overline, conceal, swallowed DCS/APC/OSC strings and a block cursor over a character in the build terminal, for browser captures of the vendored xterm's rendering. Without the parameter the fixture is unchanged. Co-Authored-By: Claude Opus 5.5 --- app/tool/perf/terminal_fixture.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/tool/perf/terminal_fixture.dart b/app/tool/perf/terminal_fixture.dart index bc6c26bf..3431937c 100644 --- a/app/tool/perf/terminal_fixture.dart +++ b/app/tool/perf/terminal_fixture.dart @@ -18,6 +18,21 @@ const String _prompt = '\x1b[1;32moperator@mac\x1b[0m:\x1b[1;34m%s\x1b[0m\$ '; String _promptAt(String folder) => _prompt.replaceFirst('%s', folder); +/// `?terminalAttrs=1`: emulator features to capture (app/third_party/xterm), +/// printed after the build terminal's prompt. The DCS, APC and OSC strings +/// must not print; the cursor ends on the `b` of `abc` as a block. +const String _attributeShowcase = + 'printf showcase\r\n' + '\x1b[4:3mcurly 4:3\x1b[0m \x1b[21mdouble 21\x1b[0m ' + '\x1b[4:4mdotted\x1b[0m \x1b[9mstrike 9\x1b[0m ' + '\x1b[53moverline\x1b[0m [\x1b[8mhidden\x1b[0m]\r\n' + '\x1b[38:2::255:128:0morange 38:2::\x1b[0m ' + '\x1b[48:5:24m bg 48:5:24 \x1b[0m ' + '\x1bP\$qm\x1b\\\x1b_apc\x1b\\' + '\x1b]8;;https://example.com\x1b\\link\x1b]8;;\x1b\\ ' + '\x1b]11;#000000\x07after strings\r\n' + 'abc\x1b[2D'; + void configureTerminalFixture(Map params) { _enabled = params['terminals'] == '1'; if (!_enabled) return; @@ -47,6 +62,9 @@ void configureTerminalFixture(Map params) { '\x1b[1;34mDesktop\x1b[0m \x1b[1;34mDocuments\x1b[0m ' '\x1b[1;34mDownloads\x1b[0m \x1b[1;34msrc\x1b[0m notes.md\r\n' '${_promptAt('~')}'; + if (params['terminalAttrs'] == '1') { + _output['term_build'] = _output['term_build']! + _attributeShowcase; + } final mode = switch (params['terminal']) { 'panel' => TerminalMode.panel, 'float' => TerminalMode.float,