Expand description
Terminal control sequence generation — cursor movement, screen, titles, bells.
Terminal control sequence generation — equivalent to Rich’s control.py.
Provides a unified Control type for composing terminal escape sequences:
cursor movement, screen manipulation, window titles, and bells. Individual
control codes can be combined and rendered as ANSI escape sequences.
§Quick Example
use rusty_rich::control::{Control, control_bell, control_home};
let bell = control_bell();
assert_eq!(bell.to_ansi(), "\x07");
let combined = Control::new(&["\x1b[H", "\x1b[2J"]);Structs§
- Control
- A composable terminal control sequence.
Constants§
- ALT_
SCREEN_ ENTER - Enter alternate screen buffer:
\x1b[?1049h - ALT_
SCREEN_ EXIT - Exit alternate screen buffer:
\x1b[?1049l - CARRIAGE_
RETURN - Carriage return:
\r - CLEAR_
HOME - Clear entire screen and move cursor to home:
\x1b[2J\x1b[H - CLEAR_
SCREEN - Clear entire screen:
\x1b[2J - CURSOR_
HIDE - Hide cursor:
\x1b[?25l - CURSOR_
HOME - Move cursor to home:
\x1b[H - CURSOR_
SHOW - Show cursor:
\x1b[?25h - CURSOR_
UP - Move cursor up one row:
\x1b[1A - ERASE_
LINE - Erase the current line:
\x1b[2K - NEWLINE
- Newline:
\n - OSC
- Operating System Command (OSC) introducer:
\x1b] - ST
- String Terminator (ST) for OSC sequences:
\x07
Functions§
- control_
bell - Ring the terminal bell.
- control_
clear - Clear the entire screen.
- control_
home - Move cursor to home position.
- control_
move_ to - Move cursor to an absolute position.
- control_
show_ cursor - Show or hide the cursor.
- control_
title - Set terminal window title.
- escape_
control_ codes - Escape control characters in a string, replacing them with visible
representations like
\\a,\\b, etc. - strip_
control_ codes - Strip control characters (bell, backspace, vertical tab, form feed) from a string.