Skip to main content

RI

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

RI (Reverse Index / Reverse Line Feed) is a C1 control function that moves the cursor up one line in the same column, scrolling the screen down if the cursor is at the top margin of the scrolling region.

Syntax​

ESC M         RI — Reverse Index (7-bit)
0x8D RI — Reverse Index (8-bit C1)
Formal syntax
RI = ( 0x1b, "M" ) | 0x8d ;

Description​

Per ECMA-48 §8.3.104, RI "causes the active presentation position to be moved in the presentation component to the corresponding character position of the preceding line."

If the cursor is at the top margin of the scrolling region (set by DECSTBM), the screen scrolls down: all lines within the scrolling region move down one position, the line at the bottom margin is lost, and a new blank line appears at the top margin.

If the cursor is above the scrolling region or on the first line of the display, RI has no effect.

RI is the inverse of IND (Index). Together they provide symmetric single-line scrolling within the scrolling region.

Examples​

printf '\eM'     # Move cursor up one line (scroll down if at top margin)

Specifications​

SpecificationSection
ECMA-48§8.3.104

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓YesESC M listed as IMPLEMENTED in docs/escape_support.md; handler reverse_index() at term/mod.rs:1861
Bobcat✓0.9.0Reverse index, handled in TerminalCtrl library
contour✓v0.1.0ESC M implemented in processSequence; calls reverseIndex()
foot✓YesImplemented in vt.c:513-514 as ESC M
Ghostty✓v1.0.0ESC M handled in stream.zig:2202-2211
iTerm2✓Yes
Kitty✓Yes
Konsole✓Yes
mintty✓YesHandled in do_esc() at src/termout.c:1967-1972
mlterm✓rel-0_2_1
PuTTY✓0.45
Rio✓v0.0.28
rxvt-unicode✓rxvt-unicode-1.2
st✓0.4
terminology✓v0.1.0
VT100✓Yes
VTE✓Yes
WezTerm✓YesHandled in performer.rs:458 via ControlCode::RI and esc.rs:40 as EscCode::ReverseIndex
Windows Terminal✓YesESC M dispatches ReverseLineFeed() in OutputStateMachineEngine.cpp:223-224
xterm✓YesImplemented in charproc.c:5468 via RevIndex()
xterm.js✓3.5.0
Multiplexers
cy✓v0.1.0
GNU Screen✓v.4.2.0RI (ESC M) implemented in DoESC() at src/ansi.c:718
tmux✓1.3Reverse index via screen_write_reverseindex()
tuios✓v0.0.15
Zellij✓v0.5.0-beta

See also​