{
  "id": "terminal-csi/ri",
  "family": "terminal-csi",
  "slug": "ri",
  "title": "CSI RI — Reverse Index",
  "summary": "ESC M (RI) moves the cursor up one line, scrolling the screen down if the cursor is at the top of the scroll region. The counterpart of IND (index, LF).",
  "kind": "control-sequence",
  "aliases": [
    "RI",
    "CSI RI — Reverse Index"
  ],
  "status": "standard",
  "verification": "verified",
  "tier": "B",
  "source_url": "https://invisible-island.net/xterm/ctlseqs/ctlseqs.html",
  "source_version": "xterm ctlseqs, patch #410, 2026/04/19",
  "retrieved_date": "2026-05-29",
  "see_also": [],
  "ext_type": "terminal-escape@1",
  "ext": {
    "csi_or_osc": "CSI",
    "command_number": "RI",
    "frame": {
      "introducer_7bit": "\u001b[",
      "introducer_7bit_readable": "ESC [ (0x1B 0x5B)",
      "introducer_8bit": "",
      "introducer_8bit_readable": "0x9B (single-byte CSI, 8-bit C1)",
      "note": "CSI sequence with final byte 'M'."
    },
    "terminator": "none",
    "terminator_detail": {
      "note": "No string terminator: the CSI sequence ends at its final byte."
    },
    "params": [
      {
        "id": "ri",
        "anchor": "#ri",
        "name": "RI",
        "meaning": "ESC M moves the cursor up one line; scrolls down if at the top margin.",
        "required": true,
        "byte_sequence_ST": "\u001bM",
        "byte_sequence_ST_readable": "ESC M (reverse index)",
        "subparams": []
      }
    ],
    "gotchas": [
      "RI is ESC M (a C1 control), not a CSI sequence, but is often listed alongside CSI controls.",
      "Reverse of IND (index / LF), which moves down and scrolls up at the bottom margin.",
      "RI respects the scroll region set by DECSTBM (CSI r)."
    ],
    "v1_smoke_test": {
      "asserts": "CSI sequence renders as a byte-exact sequence with final byte 'M'.",
      "behavioral_conformance": "deferred to v2."
    }
  },
  "updated": "2026-05-29"
}
