From 808043d8923cf613895297fa8013bbea3ea49660 Mon Sep 17 00:00:00 2001 From: knutaf Date: Mon, 25 May 2026 18:09:55 -0700 Subject: [PATCH] Add documentation for BeginSynchronizedUpdate and End- This adds documentation for the Begin Synchronized Update (BSU) and End Synchronized Update (ESU) sequences for mitigating screen tearing at high refresh rates. BSU: ESC [ ? 2026 h ESU: ESC [ ? 2026 l --- docs/console-virtual-terminal-sequences.md | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/console-virtual-terminal-sequences.md b/docs/console-virtual-terminal-sequences.md index b20e0d1..a0f225a 100644 --- a/docs/console-virtual-terminal-sequences.md +++ b/docs/console-virtual-terminal-sequences.md @@ -464,6 +464,31 @@ The following sequence can be used to reset certain properties to their default +## Synchronized Output + + +This description is largely taken from the [spec](https://github.com/contour-terminal/vt-extensions/blob/master/synchronized-output.md), only edited for clarity. + +When rendering the screen, the terminal usually iterates through each visible grid cell and renders its current state. With applications updating the screen at high frequencies, this can cause "tearing" if the renderer shows only *part* of an application's update. + +This mode attempts to mitigate that. + +When the synchronization mode is enabled (with the BSU sequence), the terminal keeps processing incoming text and sequences, but stores them without rendering them. In other words, rendering during this time will keep rendering the last rendered state without any updates. + +When the synchronized update mode is disabled (using the ESU sequence), the renderer will fetch the latest screen buffer state, effectively avoiding the tearing effect caused by unintentionally rendering in the middle of an application's screen update. + + + +| Sequence | Code | Description | Behavior | +|------------|--------|-------------|----------------------------------------------------| +| ESC \[ ? 2026 h | BSU | Begin Synchronized Update | Begin batching updates until ESU is encountered. | +| ESC \[ ? 2026 l | ESU | End Synchronized Update | End batching updates. | + +> [!TIP] +> The begin sequence ends in a lowercase H character (`h`), and the end sequence ends in a lowercase L character (`l`). + + + ## Input Sequences