Skip to content

Commit

Permalink
Add docs for multicell + control codes
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Jan 17, 2025
1 parent 21ded18 commit a8c1e42
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions docs/text-sizing-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,46 @@ There are many controls used to edit existing screen content such as
inserting characters, deleting characters and lines, etc. These were all
originally specified for the one character per cell paradigm. Here we specify
their interactions with multicell characters.

**Insert characters** (``CSI @`` aka ``ICH``)
When inserting ``n`` characters at cursor position ``x, y`` all characters
after ``x`` on line ``y`` are supposed to be right shifted. This means
that any multiline character that intersects with the cells on line ``y`` at ``x``
and beyond must be erased. Any single line multicell character that is
split by the cells at ``x`` and ``x + n - 1`` must also be erased.

**Delete characters** (``CSI P`` aka ``DCH``)
When deleting ``n`` characters at cursor position ``x, y`` all characters
after ``x`` on line ``y`` are supposed to be left shifted. This means
that any multiline character that intersects with the cells on line ``y`` at ``x``
and beyond must be erased. Any single line multicell character that is
split by the cells at ``x`` and ``x + n - 1`` must also be erased.

**Erase characters** (``CSI X`` aka ``ECH``)
When erasing ``n`` characters at cursor position ``x, y`` the ``n`` cells
starting at ``x`` are supposed ot be cleared. This means that any multicell
character that intersects with the ``n`` cells starting at ``x`` must be
erased.

**Erase display** (``CSI J`` aka ``ED``)
Any multicell character intersecting with the erased region of the screen
must be erased. When using mode ``22`` the contents of the screen are first
copied into the scrollback, including all multicell characters.

**Erase in line** (``CSI K`` aka ``EL``)
Works just like erase characters above. Any multicell character
intersecting with the erased cells in the line is erased.

**Insert lines** (``CSI L`` aka ``IL``)
When inserting ``n`` lines at cursor position ``y`` any multiline
characters that are split at the line ``y`` must be erased. A split happens
when the second or subsequent row of the multiline character is on the line
``y``. The insertion causes ``n`` lines to be removed from the bottom of
the screen, any multiline characters are split at the bottom of the screen
must be erased. A split is when any row of the multiline character except
the last row is on the last line of the screen after the insertion of ``n``
lines.

**Delete lines** (``CSI M`` aka ``DL``)
When deleting ``n`` lines at cursor position ``y`` any multicell character
that intersects the deleted lines must be erased.

0 comments on commit a8c1e42

Please sign in to comment.