Skip to main content

Module mode

Module mode 

Source
Expand description

ANSI and DEC private terminal mode management.

§Category

This module encodes SM/RM, DECSET/DECRST, DECRQM, and report responses for terminal modes. It also names commonly used modes such as alternate screen, mouse tracking, bracketed paste, synchronized output, and in-band resize.

§CSI anatomy

Standard ANSI modes omit a private prefix; DEC private modes insert ? after CSI. Final byte h sets a mode, l resets it, $p requests state, and $y reports state.

ESC [  ?  2 0 4 8  h        CSI ? 2048 h  (enable mode 2048)
──┬── ─┬─ ───┬──── ┬
 CSI  priv  params final

§Batching conventions

write_set_mode and write_reset_mode split mixed mode slices into DEC and ANSI sequences because the prefixes differ. An empty slice emits nothing.

Enums§

Mode
A terminal mode addressable by ANSI SM/RM or DECSET/DECRST.
ModeSetting
Decoded state value from a mode report response (DECRPM or ANSI report).

Functions§

write_report_mode
Write a mode-report response.
write_request_mode
Request mode status.
write_reset_mode
Reset one or more modes.
write_set_mode
Set one or more modes.