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 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 23:45:06 +00:00
parent e08afcaffd
commit 85cdc845fa
+18
View File
@@ -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); 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<String, String> params) { void configureTerminalFixture(Map<String, String> params) {
_enabled = params['terminals'] == '1'; _enabled = params['terminals'] == '1';
if (!_enabled) return; if (!_enabled) return;
@@ -47,6 +62,9 @@ void configureTerminalFixture(Map<String, String> params) {
'\x1b[1;34mDesktop\x1b[0m \x1b[1;34mDocuments\x1b[0m ' '\x1b[1;34mDesktop\x1b[0m \x1b[1;34mDocuments\x1b[0m '
'\x1b[1;34mDownloads\x1b[0m \x1b[1;34msrc\x1b[0m notes.md\r\n' '\x1b[1;34mDownloads\x1b[0m \x1b[1;34msrc\x1b[0m notes.md\r\n'
'${_promptAt('~')}'; '${_promptAt('~')}';
if (params['terminalAttrs'] == '1') {
_output['term_build'] = _output['term_build']! + _attributeShowcase;
}
final mode = switch (params['terminal']) { final mode = switch (params['terminal']) {
'panel' => TerminalMode.panel, 'panel' => TerminalMode.panel,
'float' => TerminalMode.float, 'float' => TerminalMode.float,