mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
website: IL
This commit is contained in:
119
website/app/vt/il/page.mdx
Normal file
119
website/app/vt/il/page.mdx
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
import VTSequence from "@/components/VTSequence";
|
||||||
|
|
||||||
|
# Insert Line (IL)
|
||||||
|
|
||||||
|
<VTSequence sequence={["CSI", "Pn", "L"]} />
|
||||||
|
|
||||||
|
Inserts `n` lines at the current cursor position and shifts existing
|
||||||
|
lines down.
|
||||||
|
|
||||||
|
The parameter `n` must be an integer greater than or equal to 1. If `n` is less than
|
||||||
|
or equal to 0, adjust `n` to be 1. If `n` is omitted, `n` defaults to 1.
|
||||||
|
|
||||||
|
If the current cursor position is outside of the current scroll region,
|
||||||
|
this sequence does nothing. The cursor is outside of the current scroll
|
||||||
|
region if it is above the [top margin](#TODO), below the [bottom margin](#TODO),
|
||||||
|
left of the [left margin](#TODO), or right of the [right margin](#TODO).
|
||||||
|
|
||||||
|
This sequence unsets the pending wrap state.
|
||||||
|
|
||||||
|
This sequence moves the cursor column to the left margin.
|
||||||
|
|
||||||
|
From the current cursor row down `n` lines, insert blank lines colored
|
||||||
|
with a background color according to the current SGR state. When a line is
|
||||||
|
inserted, shift all existing content down one line. The bottommost row
|
||||||
|
is the bottom margin. If content is shifted beyond the bottom margin,
|
||||||
|
it is lost and the existing content beyond the bottom margin is preserved
|
||||||
|
and not shifted.
|
||||||
|
|
||||||
|
If a [left margin](#TODO) or [right margin](#TODO) is set, only the cells
|
||||||
|
within and including the margins are blanked (when inserted) or shifted.
|
||||||
|
Other existing contents to the left of the left margin or right of the
|
||||||
|
right margin remains untouched.
|
||||||
|
|
||||||
|
If a multi-cell character would be split, erase the full multi-cell
|
||||||
|
character. For example, if "橋" is printed to the left of the left margin
|
||||||
|
and shifting the line down as a result of IL would split the character,
|
||||||
|
the cell should be erased.
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
### IL V-1: Simple Insert Line
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "\033[1;1H" # move to top-left
|
||||||
|
printf "\033[0J" # clear screen
|
||||||
|
printf "ABC\n"
|
||||||
|
printf "DEF\n"
|
||||||
|
printf "GHI\n"
|
||||||
|
printf "\033[2;2H"
|
||||||
|
printf "\033[L"
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|ABC_____|
|
||||||
|
|c_______|
|
||||||
|
|DEF_____|
|
||||||
|
|GHI_____|
|
||||||
|
```
|
||||||
|
|
||||||
|
### IL V-2: Cursor Outside of Scroll Region
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "\033[1;1H" # move to top-left
|
||||||
|
printf "\033[0J" # clear screen
|
||||||
|
printf "ABC\n"
|
||||||
|
printf "DEF\n"
|
||||||
|
printf "GHI\n"
|
||||||
|
printf "\033[3;4r" # scroll region top/bottom
|
||||||
|
printf "\033[2;2H"
|
||||||
|
printf "\033[L"
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|ABC_____|
|
||||||
|
|DEF_____|
|
||||||
|
|GHI_____|
|
||||||
|
```
|
||||||
|
|
||||||
|
### IL V-3: Top/Bottom Scroll Regions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "\033[1;1H" # move to top-left
|
||||||
|
printf "\033[0J" # clear screen
|
||||||
|
printf "ABC\n"
|
||||||
|
printf "DEF\n"
|
||||||
|
printf "GHI\n"
|
||||||
|
printf "123\n"
|
||||||
|
printf "\033[1;3r" # scroll region top/bottom
|
||||||
|
printf "\033[2;2H"
|
||||||
|
printf "\033[L"
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|ABC_____|
|
||||||
|
|_c______|
|
||||||
|
|DEF_____|
|
||||||
|
|123_____|
|
||||||
|
```
|
||||||
|
|
||||||
|
### IL V-4: Left/Right Scroll Regions
|
||||||
|
|
||||||
|
```bash
|
||||||
|
printf "\033[1;1H" # move to top-left
|
||||||
|
printf "\033[0J" # clear screen
|
||||||
|
printf "ABC123\n"
|
||||||
|
printf "DEF456\n"
|
||||||
|
printf "GHI789\n"
|
||||||
|
printf "\033[?69h" # enable left/right margins
|
||||||
|
printf "\033[2;4s" # scroll region left/right
|
||||||
|
printf "\033[2;2H"
|
||||||
|
printf "\033[L"
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|ABC123__|
|
||||||
|
|Dc__56__|
|
||||||
|
|GEF489__|
|
||||||
|
|_HI7____|
|
||||||
|
```
|
Reference in New Issue
Block a user