dracon-terminal-engine 0.1.10

A terminal application framework for Rust with composable widgets, z-indexed compositor, themes, and TextEditor
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Terminal sync mode (mode 2026) for tear-free rendering.

use std::io::Write;

/// Begins synchronized rendering mode (DECSET 2026).
///
/// Use [`begin_sync`] before drawing and [`end_sync`] after to prevent
/// tearing on supported terminals.
pub fn begin_sync<W: Write>(writer: &mut W) -> std::io::Result<()> {
    write!(writer, "\x1b[?2026h")
}

/// Ends synchronized rendering mode (DECRST 2026).
pub fn end_sync<W: Write>(writer: &mut W) -> std::io::Result<()> {
    write!(writer, "\x1b[?2026l")
}