From 29ced2a4cad3c4810a0d54921f06879afcf0184a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 24 May 2026 13:53:25 +0300 Subject: [PATCH] term.ui: use CSI ?2026 h/l for synchronized updates (fix #27136) (#27218) The DCS-based `\x1bP=1s\x1b\\` / `\x1bP=2s\x1b\\` sequences are not recognized by some terminal multiplexers (notably GNU screen), which leave stray `=1` / `=2` characters on screen. Per the synchronized updates spec, the alternate `CSI ? 2026 h/l` sequences are preferred when no parameters are passed, and are correctly interpreted by screen. --- vlib/term/ui/ui.c.v | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vlib/term/ui/ui.c.v b/vlib/term/ui/ui.c.v index bacacbb42..0285ab8ae 100644 --- a/vlib/term/ui/ui.c.v +++ b/vlib/term/ui/ui.c.v @@ -19,9 +19,11 @@ pub fn (c Color) hex() string { // Synchronized Updates spec, designed to avoid tearing during renders // https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec -const bsu = '\x1bP=1s\x1b\\' +// The alternate `CSI ? 2026 h/l` sequences are preferred when no parameters +// are passed, since they are correctly interpreted by terminals like screen. +const bsu = '\x1b[?2026h' -const esu = '\x1bP=2s\x1b\\' +const esu = '\x1b[?2026l' // write puts the string `s` into the print buffer. @[inline] -- 2.39.5