From 769840d2cbe8e6c97c3c29207e85798dadff9246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Sun, 12 Nov 2023 13:46:12 +0100 Subject: [PATCH] DECRQCRA: treat uninitialized cells as spaces The concept of uninitialized cells in wezterm is not the same as that on VT520 or that on xterm, so treat them as spaces, at least when asking for the checksum of a single cell, which is what esctest does. --- term/src/terminalstate/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs index d8c91aeff..c8d428798 100644 --- a/term/src/terminalstate/mod.rs +++ b/term/src/terminalstate/mod.rs @@ -1979,7 +1979,17 @@ impl TerminalState { checksum += u16::from(ch as u8); } } - checksum + + // Treat uninitialized cells as spaces. + // The concept of uninitialized cells in wezterm is not the same as that on VT520 or that + // on xterm, so, to prevent a lot of noise in esctest, treat them as spaces, at least when + // asking for the checksum of a single cell (which is what esctest does). + // See: https://github.com/wez/wezterm/pull/4565 + if checksum == 0 { + 32u16 + } else { + checksum + } } fn perform_csi_window(&mut self, window: Window) {