Build flags to generate website data, remove old website dir (#3012)

This adds a default-false `-Demit-webdata` build option. This emits some
files we copy over to our website (in the future I'll automate this more
to make a PR or something).

This also removes the old `website/` folder, all of the content was
moved to the website repo which is more updated.
This commit is contained in:
Mitchell Hashimoto
2024-12-18 21:13:56 -08:00
committed by GitHub
75 changed files with 165 additions and 10676 deletions

View File

@ -153,6 +153,12 @@ pub fn build(b: *std.Build) !void {
break :emit_docs path != null;
};
const emit_webdata = b.option(
bool,
"emit-webdata",
"Build the website data for the website.",
) orelse false;
const emit_xcframework = b.option(
bool,
"emit-xcframework",
@ -588,6 +594,11 @@ pub fn build(b: *std.Build) !void {
b.getInstallStep().dependOn(&b.addInstallFile(placeholder, path).step);
}
// Web data
if (emit_webdata) {
try buildWebData(b, config);
}
// App (Linux)
if (target.result.os.tag == .linux and config.app_runtime != .none) {
// https://developer.gnome.org/documentation/guidelines/maintainer/integrating.html
@ -1578,6 +1589,41 @@ fn buildDocumentation(
}
}
/// Generate the website reference data that we merge into the
/// official Ghostty website. This isn't meant to be part of any
/// actual build.
fn buildWebData(
b: *std.Build,
config: BuildConfig,
) !void {
const webgen_config = b.addExecutable(.{
.name = "webgen_config",
.root_source_file = b.path("src/main.zig"),
.target = b.host,
});
try addHelp(b, webgen_config, config);
{
const buildconfig = config: {
var copy = config;
copy.exe_entrypoint = .webgen_config;
break :config copy;
};
const options = b.addOptions();
try buildconfig.addOptions(options);
webgen_config.root_module.addOptions("build_options", options);
}
const webgen_config_step = b.addRunArtifact(webgen_config);
const webgen_config_out = webgen_config_step.captureStdOut();
b.getInstallStep().dependOn(&b.addInstallFile(
webgen_config_out,
"share/ghostty/webdata/config.mdx",
).step);
}
fn benchSteps(
b: *std.Build,
target: std.Build.ResolvedTarget,

View File

@ -0,0 +1,109 @@
const std = @import("std");
const Config = @import("../../config/Config.zig");
const help_strings = @import("help_strings");
pub fn main() !void {
const output = std.io.getStdOut().writer();
try genConfig(output);
}
pub fn genConfig(writer: anytype) !void {
// Write the header
try writer.writeAll(
\\---
\\title: Reference
\\description: Reference of all Ghostty configuration options.
\\---
\\
\\This is a reference of all Ghostty configuration options. These
\\options are ordered roughly by how common they are to be used
\\and grouped with related options. I recommend utilizing your
\\browser's search functionality to find the option you're looking
\\for.
\\
\\In the future, we'll have a more user-friendly way to view and
\\organize these options.
\\
\\
);
@setEvalBranchQuota(3000);
const fields = @typeInfo(Config).Struct.fields;
inline for (fields, 0..) |field, i| {
if (field.name[0] == '_') continue;
if (!@hasDecl(help_strings.Config, field.name)) continue;
// Write the field name.
try writer.writeAll("## `");
try writer.writeAll(field.name);
try writer.writeAll("`\n");
// For all subsequent fields with no docs, they are grouped
// with the previous field.
if (i + 1 < fields.len) {
inline for (fields[i + 1 ..]) |next_field| {
if (next_field.name[0] == '_') break;
if (@hasDecl(help_strings.Config, next_field.name)) break;
try writer.writeAll("## `");
try writer.writeAll(next_field.name);
try writer.writeAll("`\n");
}
}
// Newline after our headers
try writer.writeAll("\n");
var iter = std.mem.splitScalar(
u8,
@field(help_strings.Config, field.name),
'\n',
);
// We do some really rough markdown "parsing" here so that
// we can fix up some styles for what our website expects.
var block: ?enum {
/// Plaintext, do nothing.
text,
/// Code block, wrap in triple backticks. We use indented
/// code blocks in our comments but the website parser only
/// supports triple backticks.
code,
} = null;
while (iter.next()) |s| {
// Empty line resets our block
if (std.mem.eql(u8, s, "")) {
if (block) |v| switch (v) {
.text => {},
.code => try writer.writeAll("```\n"),
};
block = null;
try writer.writeAll("\n");
continue;
}
// If we don't have a block figure out our type.
if (block == null) {
if (std.mem.startsWith(u8, s, " ")) {
block = .code;
try writer.writeAll("```\n");
} else {
block = .text;
}
}
try writer.writeAll(switch (block.?) {
.text => s,
.code => if (std.mem.startsWith(u8, s, " "))
s[4..]
else
s,
});
try writer.writeAll("\n");
}
try writer.writeAll("\n");
}
}

View File

@ -172,6 +172,7 @@ pub const ExeEntrypoint = enum {
helpgen,
mdgen_ghostty_1,
mdgen_ghostty_5,
webgen_config,
bench_parser,
bench_stream,
bench_codepoint_width,

View File

@ -7,6 +7,7 @@ const entrypoint = switch (build_config.exe_entrypoint) {
.helpgen => @import("helpgen.zig"),
.mdgen_ghostty_1 => @import("build/mdgen/main_ghostty_1.zig"),
.mdgen_ghostty_5 => @import("build/mdgen/main_ghostty_5.zig"),
.webgen_config => @import("build/webgen/main_config.zig"),
.bench_parser => @import("bench/parser.zig"),
.bench_stream => @import("bench/stream.zig"),
.bench_codepoint_width => @import("bench/codepoint-width.zig"),

View File

@ -1,3 +0,0 @@
{
"extends": "next/core-web-vitals"
}

35
website/.gitignore vendored
View File

@ -1,35 +0,0 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts

View File

@ -1 +0,0 @@
.next/

View File

@ -1,48 +0,0 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, install the necessary dependencies:
```bash
npm install
# or
yarn install
# or
pnpm install
# or
bun install
```
Then, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

View File

@ -1,20 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--foreground-rgb: 255, 255, 255;
--background-rgb: #0e1324;
}
@media (prefers-color-scheme: dark) {
:root {
--foreground-rgb: 255, 255, 255;
--background-rgb: #0e1324;
}
}
body {
color: rgb(var(--foreground-rgb));
background-color: var(--background-rgb);
}

View File

@ -1,35 +0,0 @@
import "./globals.css";
import type { Metadata } from "next";
import { Inter, JetBrains_Mono } from "next/font/google";
const inter = Inter({
subsets: ["latin"],
display: "swap",
variable: "--font-inter",
});
const jetbrains_mono = JetBrains_Mono({
subsets: ["latin"],
display: "swap",
weight: ["100", "600"],
variable: "--font-jetbrains-mono",
});
export const metadata: Metadata = {
title: "Ghostty",
description: "👻",
};
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={`${inter.className} ${jetbrains_mono.variable}`}>
{children}
</body>
</html>
);
}

View File

@ -1,23 +0,0 @@
import Image from "next/image";
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex"></div>
<div className="relative flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:content-[''] before:lg:h-[360px] z-[-1]">
<p className="text-9xl">
<Image
src="/icon.png"
alt="Ghostty Icon"
width={250}
height={250}
priority
/>
</p>
</div>
<div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-4 lg:text-left"></div>
</main>
);
}

View File

@ -1,26 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Bell (BEL)
<VTSequence sequence="BEL" />
The purpose of the bell sequence is to raise the attention
of the user. Historically, this would [ring a physical bell](https://en.wikipedia.org/wiki/Bell_character). Today, many alternate behaviors are
acceptable:
- An audible sound can be played through the speakers
- Background or border of a window can visually flash
- The terminal window can come into focus or be put on top
- Application icon can bounce or otherwise draw attention
- A desktop notification can be shown
Normally, the bell behavior is configurable and can be disabled.
## BEL as an OSC Terminator
The `BEL` character is also a valid terminating character for
OSC sequences, although `ST` is preferred. If `BEL` is the
terminating character for an OSC sequence, any responses should
also terminate with the `BEL` character.[^1]
[^1]: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

View File

@ -1,9 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Backspace (BS)
<VTSequence sequence="BS" />
This sequence performs [cursor backward (CUB)](/vt/cub)
with `n = 1`. There is no additional or different behavior for
using `BS`.

View File

@ -1,83 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Backward Tabulation (CBT)
<VTSequence sequence={["CSI", "Pn", "Z"]} />
Move the cursor `n` tabs left.
The leftmost valid column for this operation is the first column. If
[origin mode](#TODO) is enabled, then the leftmost valid column for this
operation is the [left margin](#TODO).
Move the cursor left until the cursor position is on a tabstop. If the
cursor would move past the leftmost valid column, the cursor remains at
the leftmost valid column and the operation completes. Repeat this process
`n` times.
Tabstops are dynamic and can be set with escape sequences such as
[horizontal tab set (HTS)](/vt/hts), [tab clear (TBC)](/vt/tbc), etc.
A terminal emulator may default tabstops at any interval, though an interval
of 8 spaces is most common.
## Validation
### CBT V-1: Left Beyond First Column
```bash
printf "\033[?W" # reset tab stops
printf "\033[10Z"
printf "A"
```
```
|Ac________|
```
### CBT V-2: Left Starting After Tab Stop
```bash
printf "\033[?W" # reset tab stops
printf "\033[1;10H"
printf "X"
printf "\033[Z"
printf "A"
```
```
|________AX|
```
### CBT V-3: Left Starting on Tabstop
```bash
printf "\033[?W" # reset tab stops
printf "\033[1;9H"
printf "X"
printf "\033[1;9H"
printf "\033[Z"
printf "A"
```
```
|A_______X_|
```
### CBT V-4: Left Margin with Origin Mode
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?W" # reset tab stops
printf "\033[?6h" # enable origin mode
printf "\033[?69h" # enable left/right margins
printf "\033[3;6s" # scroll region left/right
printf "\033[1;2H" # move cursor in region
printf "X"
printf "\033[Z"
printf "A"
```
```
|__AX______|
```

View File

@ -1,70 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Horizontal Tabulation (CHT)
<VTSequence sequence={["CSI", "Pn", "I"]} />
Move the cursor `n` tabs right.
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.
The rightmost valid column for this operation is the rightmost column in
the terminal screen or the [right margin](#TODO), whichever is smaller.
This sequence does not change behavior with [origin mode](#TODO) set.
Move the cursor right until the cursor position is on a tabstop. If the
cursor would move past the rightmost valid column, the cursor remains at
the rightmost valid column and the operation completes. Repeat this process
`n` times.
Tabstops are dynamic and can be set with escape sequences such as
[horizontal tab set (HTS)](/vt/hts), [tab clear (TBC)](/vt/tbc), etc.
A terminal emulator may default tabstops at any interval, though an interval
of 8 spaces is most common.
## Validation
### CHT V-1: Right Beyond Last Column
```bash
printf "\033[?W" # reset tab stops
printf "\033[100I" # assuming the test terminal has less than 800 columns
printf "A"
```
```
|_________A|
```
### CHT V-2: Right From Before a Tabstop
```bash
printf "\033[?W" # reset tab stops
printf "\033[1;2H"
printf "A"
printf "\033[I"
printf "X"
```
```
|_A______X_|
```
### CHT V-3: Right Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?W" # reset tab stops
printf "\033[?69h" # enable left/right margins
printf "\033[3;6s" # scroll region left/right
printf "\033[1;1H" # move cursor in region
printf "X"
printf "\033[I"
printf "A"
```
```
|__AX______|
```

View File

@ -1,13 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Next Line (CNL)
<VTSequence sequence={["CSI", "Pn", "E"]} />
Move the cursor `n` cells down and to the beginning of the line.
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.
The logic of this sequence is identical to [Cursor Down (CUD)](/vt/cud)
followed by [Carriage Return (CR)](/vt/cr).

View File

@ -1,13 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Previous Line (CPL)
<VTSequence sequence={["CSI", "Pn", "F"]} />
Move the cursor `n` cells up and to the beginning of the line.
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.
The logic of this sequence is identical to [Cursor Up (CUU)](/vt/cuu)
followed by [Carriage Return (CR)](/vt/cr).

View File

@ -1,91 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Carriage Return (CR)
<VTSequence sequence="CR" />
Move the cursor to the leftmost column.
This sequence always unsets the pending wrap state.
If [origin mode (mode 6)](#TODO) is enabled, the cursor is set to the
[left margin](#TODO) of the scroll region and the operation is complete.
If origin mode is _not_ set and the cursor is on or to the right of the
left margin, the cursor is set to the left margin. If the cursor is to the left
of the left margin, the cursor is moved to the leftmost column in the terminal.
## Validation
### CR V-1: Pending Wrap is Unset
```bash
cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\r"
printf "X"
echo
```
```
|X________A|
|c_________|
```
### CR V-2: Left Margin
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margin mode
printf "\033[2;5s" # set left/right margin
printf "\033[4G"
printf "A"
printf "\r"
printf "X"
```
```
|_XcA______|
```
### CR V-3: Left of Left Margin
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margin mode
printf "\033[2;5s" # set left/right margin
printf "\033[4G"
printf "A"
printf "\033[1G"
printf "\r"
printf "X"
```
```
|Xc_A______|
```
### CR V-3: Left Margin with Origin Mode
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?6h" # enable origin mode
printf "\033[?69h" # enable left/right margin mode
printf "\033[2;5s" # set left/right margin
printf "\033[4G"
printf "A"
printf "\033[1G"
printf "\r"
printf "X"
```
```
|_XcA______|
```

View File

@ -1,182 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Backward (CUB)
<VTSequence sequence={["CSI", "Pn", "D"]} />
Move the cursor `n` cells left.
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.
This sequence always unsets the pending wrap state.
The leftmost boundary the cursor can move to is determined by the current
cursor column and the [left margin](#TODO). If the cursor begins to the left of the left margin, modify the left margin to be the leftmost column
for the duration of the sequence. The leftmost column the cursor can be on
is the left margin.
With the above in place, there are three different cursor backward behaviors
depending on the mode state of the terminal. The possible behaviors are listed
below. In the case of a conflict, the top-most behavior takes priority.
- **Extended reverse wrap**: [wraparound (mode 7)](#TODO) and [extended reverse wrap (mode 1045)](#TODO)
are **BOTH** enabled
- **Reverse wrap**: [wraparound (mode 7)](#TODO) and [reverse wrap (mode 45)](#TODO)
are **BOTH** enabled
- **No wrap**: The default behavior if the above wrapping behaviors
do not have their conditions met.
For the **no wrap** behavior, move the cursor to the left `n` cells while
respecting the aforementioned leftmost boundary. Upon reaching the leftmost
boundary, stop moving the cursor left regardless of the remaining value of `n`.
The cursor row remains unchanged.
For the **extended reverse wrap** behavior, move the cursor to the left `n`
cells while respecting the aforementioned leftmost boundary. Upon reaching the
leftmost boundary, if `n > 0` then move the cursor to the [right margin](#TODO)
of the line above the cursor. If the cursor is already on the
[top margin](#TODO), move the cursor to the right margin of the
[bottom margin](#TODO). Both the cursor column and row can change in this
mode. Compared to non-extended reverse wrap, the two critical differences are
that extended reverse wrap doesn't require the previous line to be wrapped
and extended reverse wrap will wrap around to the bottom margin.
For the **reverse wrap** (non-extended) behavior, move the cursor to the left `n`
cells while respecting the aforementioned leftmost boundary. Upon reaching the
leftmost boundary, if `n > 0` and the previous line was wrapped, then move the
cursor to the [right margin](#TODO) of the line above the cursor. If the previous
line was not wrapped, the cursor left operation is complete even if there
is a remaining value of `n`. If the cursor
is already on the [top margin](#TODO), do not move the cursor up.
This wrapping mode does not wrap the cursor row back to the bottom margin.
For **extended reverse wrap** or **reverse wrap** modes, if the pending
wrap state is set, decrease `n` by 1. In these modes, the initial cursor
backward count is consumed by the pending wrap state, as if you pressed
"backspace" on an empty newline and the cursor moved back to the previous line.
## Validation
### CUB V-1: Pending Wrap is Unset
```bash
cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\033[D" # move back one
printf "XYZ"
```
```
|________XY|
|Zc________|
```
### CUB V-2: Leftmost Boundary with Reverse Wrap Disabled
```bash
printf "\033[?45l" # disable reverse wrap
echo "A"
printf "\033[10D" # back
printf "B"
```
```
|A_________|
|Bc________|
```
### CUB V-3: Reverse Wrap
```bash
cols=$(tput cols)
printf "\033[?7h" # enable wraparound
printf "\033[?45h" # enable reverse wrap
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${cols}G" # move to end of line
printf "AB" # write and wrap
printf "\033[D" # move back two
printf "X"
```
```
|_________Xc
|B_________|
```
### CUB V-4: Extended Reverse Wrap Single Line
```bash
printf "\033[?7h" # enable wraparound
printf "\033[?1045h" # enable extended reverse wrap
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
echo "A"
printf "B"
printf "\033[2D" # move back two
printf "X"
```
```
|A________Xc
|B_________|
```
### CUB V-5: Extended Reverse Wrap Wraps to Bottom
```bash
cols=$(tput cols)
printf "\033[?7h" # enable wraparound
printf "\033[?1045h" # enable extended reverse wrap
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;3r" # set scrolling region
echo "A"
printf "B"
printf "\033[D" # move back one
printf "\033[${cols}D" # move back entire width
printf "\033[D" # move back one
printf "X"
```
```
|A_________|
|B_________|
|_________Xc
```
### CUB V-6: Reverse Wrap Outside of Margins
```bash
printf "\033[1;1H"
printf "\033[0J"
printf "\033[?45h"
printf "\033[3r"
printf "\b"
printf "X"
```
```
|__________|
|__________|
|Xc________|
```
### CUB V-7: Reverse Wrap with Pending Wrap State
```bash
cols=$(tput cols)
printf "\033[?45h"
printf "\033[${cols}G"
printf "\033[4D"
printf "ABCDE"
printf "\033[D"
printf "X"
```
```
|_____ABCDX|
```

View File

@ -1,75 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Down (CUD)
<VTSequence sequence={["CSI", "Pn", "B"]} />
Move the cursor `n` cells 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.
This sequence always unsets the pending wrap state.
If the current cursor position is at or above the [bottom margin](#TODO),
the lowest point the cursor can move is the bottom margin. If the current
cursor position is below the bottom margin, the lowest point the cursor
can move is the final row.
This sequence never triggers scrolling.
## Validation
### CUD V-1: Cursor Down
```bash
printf "A"
printf "\033[2B" # cursor down
printf "X"
```
```
|A_________|
|__________|
|_Xc_______|
```
### CUD V-2: Cursor Down Above Bottom Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\n\n\n\n" # screen is 4 high
printf "\033[1;3r" # set scrolling region
printf "A"
printf "\033[5B" # cursor down
printf "X"
```
```
|A_________|
|__________|
|_Xc_______|
|__________|
```
### CUD V-3: Cursor Down Below Bottom Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\n\n\n\n\n" # screen is 5 high
printf "\033[1;3r" # set scrolling region
printf "A"
printf "\033[4;1H" # move below region
printf "\033[5B" # cursor down
printf "X"
```
```
|A_________|
|__________|
|__________|
|__________|
|_Xc_______|
```

View File

@ -1,83 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Forward (CUF)
<VTSequence sequence={["CSI", "Pn", "C"]} />
Move the cursor `n` cells right.
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.
This sequence always unsets the pending wrap state.
The rightmost boundary the cursor can move to is determined by the current
cursor column and the [right margin](#TODO). If the cursor begins to the right
of the right margin, modify the right margin to be the rightmost column
of the screen for the duration of the sequence. The rightmost column the cursor
can be on is the right margin.
Move the cursor `n` cells to the right up to and including the rightmost boundary.
This sequence never wraps or modifies cell content. This sequence is not affected
by any terminal modes.
## Validation
### CUF V-1: Pending Wrap is Unset
```bash
cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\033[C" # move forward one
printf "XYZ"
```
```
|_________X|
|YZ________|
```
### CUF V-2: Rightmost Boundary with Reverse Wrap Disabled
```bash
printf "A"
printf "\033[500C" # forward larger than screen width
printf "B"
```
```
|A________Bc
```
### CUF V-3: Left of the Right Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[1G" # move to left
printf "\033[500C" # forward larger than screen width
printf "X"
```
```
|____X_____|
```
### CUF V-4: Right of the Right Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[6G" # move to right of margin
printf "\033[500C" # forward larger than screen width
printf "X"
```
```
|_________X|
```

View File

@ -1,127 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Position (CUP)
<VTSequence sequence={["CSI", "Py", ";", "Px", "H"]} />
Move the cursor to row `y` and column `x`.
The parameters `y` and `x` must be integers greater than or equal to 1.
If either is less than or equal to 0, adjust that parameter to be 1.
The values `y` and `x` are both one-based. For example, the top row is row 1
and the leftmost column on the screen is column 1.
This sequence always unsets the pending wrap state.
If [origin mode](#TODO) is **NOT** set, the cursor is moved exactly to the
row and column specified by `y` and `x`. The maximum value for `y` is the
bottom row of the screen and the maximum value for `x` is the rightmost
column of the screen.
If [origin mode](#TODO) is set, the cursor position is set relative
to the top-left corner of the scroll region. `y = 1` corresponds to
the [top margin](#TODO) and `x = 1` corresponds to the [left margin](#TODO).
The maximum value for `y` is the [bottom margin](#TODO) and the maximum
value for `x` is the [right margin](#TODO).
When origin mode is set, it is impossible set a cursor position using
this sequence outside the boundaries of the scroll region.
## Validation
### CUP V-1: Normal Usage
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[2;3H"
printf "A"
```
```
|__________|
|__Ac______|
```
### CUP V-2: Off the Screen
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[500;500H"
printf "A"
```
```
|__________|
|__________|
|_________Ac
```
### CUP V-3: Relative to Origin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[2;3r" # scroll region top/bottom
printf "\033[?6h" # origin mode
printf "\033[1;1H" # move to top-left
printf "X"
```
```
|__________|
|X_________|
```
### CUP V-4: Relative to Origin with Left/Right Margins
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[2;3r" # scroll region top/bottom
printf "\033[?6h" # origin mode
printf "\033[1;1H" # move to top-left
printf "X"
```
```
|__________|
|__X_______|
```
### CUP V-5: Limits with Scroll Region and Origin Mode
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[2;3r" # scroll region top/bottom
printf "\033[?6h" # origin mode
printf "\033[500;500H" # move to top-left
printf "X"
```
```
|__________|
|__________|
|____X_____|
```
### CUP V-6: Pending Wrap is Unset
```bash
cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\033[1;1H"
printf "X"
```
```
|Xc_______X|
```

View File

@ -1,78 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Cursor Up (CUU)
<VTSequence sequence={["CSI", "Pn", "A"]} />
Move the cursor `n` cells up.
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.
This sequence always unsets the pending wrap state.
If the current cursor position is at or below the [top margin](#TODO),
the highest point the cursor can move is the top margin. If the current
cursor position is above the top margin, the highest point the cursor
can move is the first row.
## Validation
### CUU V-1: Cursor Up
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[3;1H"
printf "A"
printf "\033[2A" # cursor up
printf "X"
```
```
|_Xc_______|
|__________|
|A_________|
```
### CUU V-2: Cursor Up Below Top Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\n\n\n\n" # screen is 4 high
printf "\033[2;4r" # set scrolling region
printf "\033[3;1H"
printf "A"
printf "\033[5A" # cursor up
printf "X"
```
```
|__________|
|_Xc_______|
|A_________|
|__________|
```
### CUU V-3: Cursor Up Above Top Margin
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\n\n\n\n\n" # screen is 5 high
printf "\033[3;5r" # set scrolling region
printf "\033[3;1H"
printf "A"
printf "\033[2;1H" # move above region
printf "\033[5A" # cursor up
printf "X"
```
```
|Xc________|
|__________|
|A_________|
|__________|
|__________|
```

View File

@ -1,106 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Delete Character (DCH)
<VTSequence sequence={["CSI", "Pn", "P"]} />
Deletes `n` characters at the current cursor position and shifts existing
cell contents left.
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 left of the [left margin](#TODO), or right of the
[right margin](#TODO).
This sequence unsets the pending wrap state. This sequence does _not_ unset
the pending wrap state if the cursor position is outside of the current
scroll region. This has to be called out explicitly because this behavior
differs from [Insert Character (ICH)](/vt/ich).
Only cells within the scroll region are deleted or shifted. Cells to the
right of the right margin are unmodified.
The blank cells inserted from the right margin are blank with the background
color colored according to the current SGR state.
If a multi-cell character (such as "橋") is shifted so that the cell is split
in half, the multi-cell character can either be clipped or erased. Typical
behavior is to clip at the right edge of the screen and erase at a right
margin, but either behavior is acceptable.
## Validation
### DCH V-1: Simple Delete Character
```bash
printf "ABC123"
printf "\033[3G"
printf "\033[2P"
```
```
|AB23____|
```
### DCH V-2: SGR State
```bash
printf "ABC123"
printf "\033[3G"
printf "\033[41m"
printf "\033[2P"
```
```
|AB23____|
```
The two rightmost cells should have a red background color.
### DCH V-3: Outside Left/Right Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "ABC123"
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[2G"
printf "\033[P"
```
```
|ABC123__|
```
### DCH V-4: Inside Left/Right Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "ABC123"
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[4G"
printf "\033[P"
```
```
|ABC2_3__|
```
### DCH V-5: Split Wide Character
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A橋123"
printf "\033[3G"
printf "\033[P"
```
```
|A_123_____|
```

View File

@ -1,45 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Screen Alignment Test (DECALN)
<VTSequence sequence={["ESC", "#", "8"]} />
Reset margins, move cursor to the top left, and fill the screen with `E`.
Reset the top, bottom, left, and right margins and unset [origin mode](#TODO).
The cursor is moved to the top-left corner of the screen.
All stylistic SGR attributes are unset, such as bold, blink, etc.
SGR foreground and background colors are preserved.
The [protected attribute](#TODO) is not unset.
The entire screen is filled with the character `E`. The letter `E` ignores
the current SGR settings and is written with no styling.
## Validation
### DECALN V-1: Simple Usage
```bash
printf "\033#8"
```
```
|EEEEEEEE|
|EEEEEEEE|
|EEEEEEEE|
```
### DECALN V-2: Reset Margins
```bash
printf "\033[2;3r" # scroll region top/bottom
printf "\033#8"
printf "\033[T"
```
```
|c_______|
|EEEEEEEE|
|EEEEEEEE|
```

View File

@ -1,7 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Keypad Application Mode (DECKPAM)
<VTSequence sequence={["ESC", "="]} />
Sets keypad application mode.

View File

@ -1,7 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Keypad Numeric Mode (DECKPNM)
<VTSequence sequence={["ESC", ">"]} />
Sets keypad numeric mode.

View File

@ -1,14 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Restore Cursor (DECRC)
<VTSequence sequence={["ESC", "8"]} />
Restore the cursor-related state saved via [Save Cursor (DECSC)](/vt/decsc).
If a cursor was never previously saved, this sets all the typically saved
values to their default values.
## Validation
Validation is shared with [Save Cursor (DECSC)](/vt/decsc).

View File

@ -1,83 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Save Cursor (DECSC)
<VTSequence sequence={["ESC", "7"]} />
Save various cursor-related state that can be restored with
[Restore Cursor (DECRC)](/vt/decrc).
The following attributes are saved:
- Cursor row and column in absolute screen coordinates
- Character sets
- Pending wrap state
- SGR attributes
- [Origin mode (DEC Mode 6)](/vt/modes/origin)
Only one cursor can be saved at any time. If save cursor is repeated, the
previously save cursor is overwritten.
Primary and alternate screens have separate saved cursor state. A cursor
saved on the primary screen is inaccessible from the alternate screen
and vice versa.
## Validation
### SC V-1: Cursor Position
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;5H"
printf "A"
printf "\0337" # Save Cursor
printf "\033[1;1H"
printf "B"
printf "\0338" # Restore Cursor
printf "X"
```
```
|B___AX____|
```
### SC V-2: Pending Wrap State
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${cols}G"
printf "A"
printf "\0337" # Save Cursor
printf "\033[1;1H"
printf "B"
printf "\0338" # Restore Cursor
printf "X"
```
```
|B________A|
|X_________|
```
### SC V-3: SGR Attributes
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;4;33;44m"
printf "A"
printf "\0337" # Save Cursor
printf "\033[0m"
printf "B"
printf "\0338" # Restore Cursor
printf "X"
```
```
|AX________|
```
The "A" and "X" should have identical styling.

View File

@ -1,24 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Set Cursor Style (DECSCUSR)
<VTSequence sequence={["ESC", "Pn", " ", "q"]} />
Set the mouse cursor style.
If `n` is omitted, `n` defaults to `0`. `n` must be an integer between
0 and 6 (inclusive). The mapping of `n` to cursor style is below:
| n | style |
| --- | --------------------- |
| 0 | terminal default |
| 1 | blinking block |
| 2 | steady block |
| 3 | blinking underline |
| 4 | steady underline |
| 5 | blinking vertical bar |
| 6 | steady vertical bar |
For `n = 0`, the terminal default is up to the terminal and is inconsistent
across terminal implementations. The default may also be impacted by terminal
configuration.

View File

@ -1,120 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Set Left and Right Margins (DECSLRM)
<VTSequence sequence={["CSI", "Pl", ";", "Pr", "s"]} />
Sets the left and right margins, otherwise known as the scroll region.
To learn more about scroll regions in general, see
[Set Top and Bottom Margins](/vt/decstbm).
Parameters `l` and `r` are integer values. If either value is zero the
value will be reset to default values. The default value for `l` is `1`
and the default value of `r` is the number of columns in the screen.
Values `l` and `r` can be omitted. If either value is omitted, their
default values will be used. Note that it is impossible to omit `l`
and not omit `r`.
This sequence requires [enable left and right margin (mode 69)](#TODO)
to be set. If mode 69 is not set, this sequence does nothing and left
and right margins will not be set.
This sequence conflicts with [save cursor (`CSI s`)](#TODO). If
mode 69 is disabled, save cursor will be invoked. If mode 69 is enabled,
the `CSI s` save cursor sequence will be disabled, but save cursor is always
also available as `ESC 7`.
If left is larger or equal to right, this sequence does nothing. A
scroll region must be at least two columns (`r` must be greater than `l`).
The rest of this sequence description assumes valid values for `l` and `r`.
This sequence unsets the pending wrap state and moves the cursor to
the top-left of the screen. If [origin mode](#TODO) is set, the cursor is
moved to the top-left of the scroll region.
To reset the left and right margins, call this sequence with both values set to
"0". This will force the default values for both `l` and `r` which is
the full screen. Unsetting mode 69 will also reset the left and right margins.
## Validation
### DECSLRM V-1: Full Screen
```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[?69h" # enable left/right margins
printf "\033[s" # scroll region left/right
printf "\033[X"
```
```
|cBC_____|
|DEF_____|
|GHI_____|
```
### DECSLRM V-2: Left Only
```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[?69h" # enable left/right margins
printf "\033[2s" # scroll region left/right
printf "\033[2G" # move cursor to column 2
printf "\033[L"
```
```
|Ac______|
|DBC_____|
|GEF_____|
| HI_____|
```
### DECSLRM V-3: Left And Right
```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[?69h" # enable left/right margins
printf "\033[1;2s" # scroll region left/right
printf "\033[2G" # move cursor to column 2
printf "\033[L"
```
```
|_cC_____|
|ABF_____|
|DEI_____|
|GH______|
```
### DECSLRM V-4: Left Equal to Right
```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[?69h" # enable left/right margins
printf "\033[2;2s" # scroll region left/right
printf "\033[X"
```
```
|cBC_____|
|DEF_____|
|GHI_____|
```

View File

@ -1,111 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Set Top and Bottom Margins (DECSTBM)
<VTSequence sequence={["CSI", "Pt", ";", "Pb", "r"]} />
Sets the top and bottom margins, otherwise known as the scroll region.
Parameters `t` and `b` are integer values. If either value is zero the
value will be reset to default values. The default value for `t` is `1`
and the default value of `b` is the number of rows in the screen.
Values `t` and `b` can be omitted. If either value is omitted, their
default values will be used. Note that it is impossible to omit `t`
and not omit `b`. The only valid sequences are `CSI t ; b r`,
`CSI t r` and `CSI r`.
If top is larger or equal to bottom, this sequence does nothing. A
scroll region must be at least two rows (`b` must be greater than `t`).
The rest of this sequence description assumes valid values for `t` and `b`.
This sequence unsets the pending wrap state and moves the cursor to
the top-left of the screen. If [origin mode](#TODO) is set, the cursor is
moved to the top-left of the scroll region.
To reset the scroll region, call this sequence with both values set to
"0". This will force the default values for both `t` and `b` which is
the full screen.
The top and bottom margin constitute what is known as the _scroll region_.
The scroll region impacts the operation of many sequences such as
[insert line](/vt/il), [cursor down](/vt/cud), etc. Scroll regions are
an effective and efficient way to constraint terminal modifications to a
rectangular region of the screen.
## Validation
### DECSTBM V-1: Full Screen
```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[r" # scroll region top/bottom
printf "\033[T"
```
```
|c_______|
|ABC_____|
|DEF_____|
|GHI_____|
```
### DECSTBM V-2: Top Only
```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[2r" # scroll region top/bottom
printf "\033[T"
```
```
|ABC_____|
|________|
|DEF_____|
|GHI_____|
```
### DECSTBM V-3: Top and Bottom
```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[1;2r" # scroll region top/bottom
printf "\033[T"
```
```
|________|
|ABC_____|
|GHI_____|
```
### DECSTBM V-4: Top Equal to Bottom
```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;2r" # scroll region top/bottom
printf "\033[T"
```
```
|________|
|ABC_____|
|DEF_____|
|GHI_____|
```

View File

@ -1,113 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Delete Line (DL)
<VTSequence sequence={["CSI", "Pn", "M"]} />
Deletes `n` lines at the current cursor position and shifts existing
lines up.
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.
Remove the top `n` lines of the current scroll region, and shift existing
lines up. The space created at the bottom of the scroll region should be
blank with the background color set according to the current SGR state.
If a [left margin](#TODO) or [right margin](#TODO) is set, only the cells
within and including the margins are deleted 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 DL would split the character,
the cell should be erased.
## Validation
### DL V-1: Simple Delete 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[M"
```
```
|ABC_____|
|GHI_____|
```
### DL 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[M"
```
```
|ABC_____|
|DEF_____|
|GHI_____|
```
### DL 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[M"
```
```
|ABC_____|
|GHI_____|
|________|
|123_____|
```
### DL 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[M"
```
```
|ABC123__|
|DHI756__|
|G___89__|
```

View File

@ -1,46 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Device Status Report (DSR)
<VTSequence sequence={["CSI", "Pn", "n"]} />
Request information from the terminal depending on the value of `n`.
The possible valid values of `n` are described in the paragraphs below. If
any other value of `n` is provided, this sequence does nothing.
If `n = 5`, the _operating status_ is requested. The terminal responds
to the program with `ESC [ 0 n` to indicate no malfunctions.
If `n = 6`, the _cursor position_ is requested. The terminal responds to
the program in the format `ESC [ y ; x R` where `y` is the row and `x`
is the column, both one-indexed. If [origin mode (DEC Mode 6)](/vt/modes/origin)
is enabled, the reported cursor position is relative to the top-left of the
scroll region.
## Validation
### DSR V-1: Operating Status
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[5n"
```
```
|^[[0n_____|
```
### DSR V-2: Cursor Position
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[2;4H" # move to top-left
printf "\033[6n"
```
```
^[[2;4R
```

View File

@ -1,158 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Erase Character (ECH)
<VTSequence sequence={["CSI", "Pn", "X"]} />
Blank `n` cells beginning with (including) and to the right of the cursor.
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.
The rightmost column that can be erased is the rightmost column of the screen.
The [right margin](#) has no effect on this sequence.
This sequence always unsets the pending wrap state. If the row under the cursor
is soft-wrapped, then the soft-wrap state is also reset.
For `n` cells up to the rightmost column, blank the cell by replacing it
with an empty character with the background color colored according to the
current SGR state. No other SGR attributes are preserved.
If a multi-cell character would be split, erase the full multi-cell
character. For example, if "橋" is printed and ECH `n = 1` is issued,
the full character should be erased even though it takes up two cells.
Both erased cells are colored with the current background color according
to the current SGR state.
If [Select Character Selection Attribute (DECSCA)](#TODO) is enabled
or was the most recently enabled protection mode on the currently active screen,
protected attributes are ignored as if they were never set and the cells
with them are erased. It does not matter if DECSCA is currently disabled,
protected attributes are still ignored so long as DECSCA was the
_most recently enabled_ protection mode.
If DECSCA is not currently enabled and was not the most recently enabled protection
mode on the currently active screen, cells with the protected attribute set are
respected and not erased but still count towards `n`. It does not matter if the
protection attribute for a cell was originally set from DECSCA.
## Validation
### ECH V-1: Simple Operation
```bash
printf "ABC"
printf "\033[1G"
printf "\033[2X"
```
```
|c_C_____|
```
### ECH V-2: Erasing Beyond Edge of Screen
```bash
cols=$(tput cols)
printf "\033[${cols}G"
printf "\033[2D"
printf "ABC"
printf "\033[D"
printf "\033[10X"
```
```
|_____Ac_|
```
### ECH V-3: Reset Pending Wrap State
```bash
cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\033[X"
printf "X"
```
```
|_______Xc
```
### ECH V-4: SGR State
```bash
printf "ABC"
printf "\033[1G"
printf "\033[41m"
printf "\033[2X"
```
```
|c_C_____|
```
The `c_` cells should both have a red background. All other cells
remain unchanged in style.
### ECH V-5: Multi-cell Character
```bash
printf "橋BC"
printf "\033[1G"
printf "\033[X"
printf "X"
```
```
|XcBC____|
```
### ECH V-6: Left/Right Scroll Region Ignored
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[1;3s" # scroll region left/right
printf "\033[4G"
printf "ABC"
printf "\033[1G"
printf "\033[4X"
```
```
|c___BC____|
```
### ECH V-7: Protected Attributes Ignored with DECSCA
```bash
printf "\033V"
printf "ABC"
printf "\033[1\"q"
printf "\033[0\"q"
printf "\033[1G"
printf "\033[2X"
```
```
|c_C_______|
```
### ECH V-8: Protected Attributes Respected without DECSCA
```bash
printf "\033[1\"q"
printf "ABC"
printf "\033V"
printf "\033[1G"
printf "\033[2X"
```
```
|ABC_______|
```
The cursor remains at `A`.

View File

@ -1,139 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Erase Display (ED)
<VTSequence sequence={["CSI", "Pn", "J"]} />
Erase display contents with behavior depending on the command `n`.
If `n` is unset, the value of `n` is 0. The only valid values for `n` are
0, 1, 2, or 3. If any other value of `n` is given, do not execute this sequence.
The remainder of the sequence documentation assumes a valid value of `n`.
For all valid values of `n` except 3, this sequence unsets the pending wrap state.
The cursor position will remain unchanged under all circumstances throughout
this sequence.
If [Select Character Selection Attribute (DECSCA)](#TODO) is enabled
or was the most recently enabled protection mode on the currently active screen,
protected attributes are ignored. Otherwise, protected attributes will be
respected. For more details on this specific logic for protected attribute
handling, see [Erase Character (ECH)](/vt/ech).
For all operations, if a multi-cell character would be split, erase the full multi-cell
character. For example, if "橋" is printed and the erase would only erase the
first or second cell of the two-cell character, both cells should be erased.
This sequence does not respect any scroll regions (top, bottom, left, or
right). The boundaries of the operation are the full visible screen.
If `n` is `0`, perform an **erase display below** operation. Erase all
cells to the right and below the cursor. The background color of erased cells
is colored according to the current SGR state.
If `n` is `1`, perform an **erase display above** operation. Erase all
cells to the left and above the cursor. The background color of erased cells
is colored according to the current SGR state.
If `n` is `2`, **erase the entire display**. This is the equivalent of
erase above (`n = 1`) and erase below (`n = 0`) both being executed.
If `n` is `3`, **erase only the scrollback region**. This does not affect
the visible display of the screen and does not move the cursor. The scrollback
region is the region of the terminal that is currently above the visible
area of the screen when the screen is scrolled completely to the bottom.
## Validation
### ED V-1: Simple Erase Below
```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[0J"
```
```
|ABC_____|
|Dc______|
|________|
```
### ED V-2: Erase Below SGR State
```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[41m"
printf "\033[0J"
```
```
|ABC_____|
|Dc______|
|________|
```
All the cells right and below of the cursor should be colored red.
### ED V-3: Erase Below Multi-Cell Character
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "AB橋C\n"
printf "DE橋F\n"
printf "GH橋I\n"
printf "\033[2;4H"
printf "\033[0J"
```
```
|AB橋C___|
|DE_c____|
|________|
```
### ED V-4: Simple Erase Above
```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[1J"
```
```
|________|
|_cF_____|
|GHI_____|
```
### ED V-5: Simple Erase Complete
```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[2J"
```
```
|________|
|_c______|
|________|
```

View File

@ -1,227 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Erase Line (EL)
<VTSequence sequence={["CSI", "Pn", "K"]} />
Erase line contents with behavior depending on the command `n`.
If `n` is unset, the value of `n` is 0. The only valid values for `n` are
0, 1, or 2. If any other value of `n` is given, do not execute this sequence.
The remainder of the sequence documentation assumes a valid value of `n`.
For all valid values of `n`, this sequence unsets the pending wrap state.
The cursor position will remain unchanged under all circumstances throughout
this sequence.
If [Select Character Selection Attribute (DECSCA)](#TODO) is enabled
or was the most recently enabled protection mode on the currently active screen,
protected attributes are ignored. Otherwise, protected attributes will be
respected. For more details on this specific logic for protected attribute
handling, see [Erase Character (ECH)](/vt/ech).
For all operations, if a multi-cell character would be split, erase the full multi-cell
character. For example, if "橋" is printed and the erase would only erase the
first or second cell of the two-cell character, both cells should be erased.
If `n` is `0`, perform an **erase line right** operation. Erase line right
is equivalent to [Erase Character (ECH)](/vt/ech) with `n` set to the total
remaining columns from the cursor to the end of the line (and including
the cursor). If the line is softwrapped, only the single row is erased;
it does not erase through the wrap. Further, the wrap state of the row is
reset such that the line is no longer considered wrapped.
If `n` is `1`, perform an **erase line left** operation. This replaces
the `n` cells left of and including the cursor with a blank character and
colors the background according to the current SGR state. The leftmost
column that can be blanked is the first column of the screen. The
[left margin](#TODO) has no effect on this operation.
If `n` is `2`, **erase the entire line**. This is the equivalent of
erase left (`n = 1`) and erase right (`n = 0`) both being executed.
## Validation
### EL V-1: Simple Erase Right
```bash
printf "ABCDE"
printf "\033[3G"
printf "\033[0K"
```
```
|ABc_____|
```
### EL V-2: Erase Right Resets Pending Wrap
```bash
cols=$(tput cols)
printf "\033[${cols}G" # move to last column
printf "A" # set pending wrap state
printf "\033[0K"
printf "X"
```
```
|_______X|
```
The cursor should be on the 'X'
### EL V-3: Erase Right SGR State
```bash
printf "ABC"
printf "\033[2G"
printf "\033[41m"
printf "\033[0K"
```
```
|Ac______|
```
The cells from `c` onwards should have a red background all the way to
the right edge of the screen.
### EL V-4: Erase Right Multi-cell Character
```bash
printf "AB橋DE"
printf "\033[4G"
printf "\033[0K"
```
```
|AB_c____|
```
### EL V-5: Erase Right Left/Right Scroll Region Ignored
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "ABCDE"
printf "\033[?69h" # enable left/right margins
printf "\033[1;3s" # scroll region left/right
printf "\033[2G"
printf "\033[0K"
```
```
|Ac________|
```
### EL V-6: Erase Right Protected Attributes Ignored with DECSCA
```bash
printf "\033V"
printf "ABCDE"
printf "\033[1\"q"
printf "\033[0\"q"
printf "\033[2G"
printf "\033[0K"
```
```
|Ac________|
```
### EL V-7: Protected Attributes Respected without DECSCA
```bash
printf "\033[1\"q"
printf "ABCDE"
printf "\033V"
printf "\033[2G"
printf "\033[0K"
printf "\033[1K"
printf "\033[2K"
```
```
|ABCDE_____|
```
### EL V-8: Simple Erase Left
```bash
printf "ABCDE"
printf "\033[3G"
printf "\033[1K"
```
```
|__cDE___|
```
### EL V-9: Erase Left SGR State
```bash
printf "ABC"
printf "\033[2G"
printf "\033[41m"
printf "\033[1K"
```
```
|_cC_____|
```
The cells from `c` to the left should have a red background.
### EL V-10: Erase Left Multi-cell Character
```bash
printf "AB橋DE"
printf "\033[3G"
printf "\033[1K"
```
```
|__c_DE__|
```
### EL V-11: Erase Left Protected Attributes Ignored with DECSCA
```bash
printf "\033V"
printf "ABCDE"
printf "\033[1\"q"
printf "\033[0\"q"
printf "\033[2G"
printf "\033[1K"
```
```
|_cCDE_____|
```
### EL V-12: Simple Erase Complete
```bash
printf "ABCDE"
printf "\033[3G"
printf "\033[2K"
```
```
|__c_______|
```
### EL V-13: Erase Complete SGR State
```bash
printf "ABC"
printf "\033[2G"
printf "\033[41m"
printf "\033[2K"
```
```
|_c______|
```
The entire line should have a red background.

View File

@ -1,14 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Horizontal Position Absolute (HPA)
<VTSequence sequence={["CSI", "Px", "`"]} />
This sequence performs [cursor position (CUP)](/vt/cup) with `x` set
to the parameterized value and `y` set to the current cursor position.
There is no additional or different behavior for using `HPA`.
Because this invokes `CUP`, the cursor row (`x`) can change if it is
outside the bounds of the `CUP` operation. For example, if
[origin mode](#TODO) is set and the current cursor position is outside
of the scroll region, the row will be adjusted.

View File

@ -1,17 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Horizontal Position Relative (HPR)
<VTSequence sequence={["CSI", "Px", "a"]} />
This sequence performs [cursor position (CUP)](/vt/cup) with `x` set
to the current cursor column plus `x` and `y` set to the current cursor row.
There is no additional or different behavior for using `HPR`.
The parameter `x` must be an integer greater than or equal to 1. If `x` is less than
or equal to 0, adjust `x` to be 1. If `x` is omitted, `x` defaults to 1.
Because this invokes `CUP`, the cursor row (`y`) can change if it is
outside the bounds of the `CUP` operation. For example, if
[origin mode](#TODO) is set and the current cursor position is outside
of the scroll region, the row will be adjusted.

View File

@ -1,129 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Insert Character (ICH)
<VTSequence sequence={["CSI", "Pn", "@"]} />
Insert `n` blank characters at the current cursor position and shift
existing cell contents right.
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.
This sequence always unsets the pending wrap state.
If the cursor position is outside of the [left and right margins](#TODO),
this sequence does not change the screen, but the pending wrap state is
still reset.
Existing cells shifted beyond the right margin are deleted. Inserted cells
are blank with the background color colored according to the current SGR state.
If a multi-cell character (such as "橋") is shifted so that the cell is split
in half, the multi-cell character can either be clipped or erased. Typical
behavior is to clip at the right edge of the screen and erase at a right
margin, but either behavior is acceptable.
## Validation
### ICH V-1: No Scroll Region, Fits on Screen
```bash
printf "ABC"
printf "\033[1G"
printf "\033[2@"
printf "X"
```
```
|XcABC_____|
```
### ICH V-2: SGR State
```bash
printf "ABC"
printf "\033[1G"
printf "\033[41m"
printf "\033[2@"
printf "X"
```
```
|c_ABC_____|
```
The `c_` cells should both have a red background. The `ABC` cells should
remain unchanged in style.
### ICH V-3: Shifting Content Off the Screen
```bash
cols=$(tput cols)
printf "\033[${cols}G"
printf "\033[2D"
printf "ABC"
printf "\033[2D"
printf "\033[2@"
printf "X"
```
```
|_______XcA|
```
### ICH V-4: Inside Left/Right Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[3G"
printf "ABC"
printf "\033[3G"
printf "\033[2@"
printf "X"
```
```
|__XcA_____|
```
### ICH V-5: Outside Left/Right Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[3;5s" # scroll region left/right
printf "\033[3G"
printf "ABC"
printf "\033[1G"
printf "\033[2@"
printf "X"
```
```
|XcABC_____|
```
### ICH V-6: Split Wide Character
```bash
cols=$(tput cols)
printf "\033[${cols}G"
printf "\033[1D"
printf "橋"
printf "\033[2D"
printf "\033[@"
printf "X"
```
```
|_______Xc_|
```
In this case, it is valid for the last cell to be blank or to clip the
multi-cell character. xterm clips the character but many other terminals
erase the cell.

View File

@ -1,119 +0,0 @@
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____|
```

View File

@ -1,159 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Index (IND)
<VTSequence sequence={["ESC", "D"]} />
Move the cursor down one cell, scrolling if necessary.
This sequence always unsets the pending wrap state.
If the cursor is exactly on the bottom margin and is at or within the
[left](#TODO) and [right margin](#TODO), [scroll up](#TODO) one line.
If the scroll region is the full terminal screen and the terminal is on
the [primary screen](#TODO), this may create scrollback. See the
[scroll](#TODO) documentation for more details.
If the cursor is outside of the scroll region or not on the bottom
margin of the scroll region, perform the [cursor down](/vt/cud) operation with
`n = 1`.
This sequence will only scroll when the cursor is exactly on the bottom
margin and within the remaining scroll region. If the cursor is outside
the scroll region and on the bottom line of the terminal, the cursor
does not move.
## Validation
### IND V-1: No Scroll Region, Top of Screen
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A"
printf "\033D" # index
printf "X"
```
```
|A_________|
|_Xc_______|
```
### IND V-2: Bottom of Primary Screen
```bash
lines=$(tput lines)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${lines};1H" # move to bottom-left
printf "A"
printf "\033D" # index
printf "X"
```
```
|A_________|
|_Xc_______|
```
### IND V-3: Inside Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;3r" # scroll region
printf "A"
printf "\033D" # index
printf "X"
```
```
|A_________|
|_Xc_______|
```
### IND V-4: Bottom of Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;3r" # scroll region
printf "\033[4;1H" # below scroll region
printf "B"
printf "\033[3;1H" # move to last row of region
printf "A"
printf "\033D" # index
printf "X"
```
```
|__________|
|A_________|
|_Xc_______|
|B_________|
```
### IND V-5: Bottom of Primary Screen with Scroll Region
```bash
lines=$(tput lines)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[1;3r" # scroll region
printf "\033[3;1H" # move to last row of region
printf "A"
printf "\033[${lines};1H" # move to bottom-left
printf "\033D" # index
printf "X"
```
```
|__________|
|__________|
|A_________|
|__________|
|Xc________|
```
### IND V-6: Outside of Left/Right Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?69h" # enable left/right margins
printf "\033[1;3r" # scroll region top/bottom
printf "\033[3;5s" # scroll region left/right
printf "\033[3;3H"
printf "A"
printf "\033[3;1H"
printf "\033D" # index
printf "X"
```
```
|__________|
|__________|
|XcA_______|
```
### IND V-7: Inside of Left/Right Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "AAAAAA\n"
printf "AAAAAA\n"
printf "AAAAAA"
printf "\033[?69h" # enable left/right margins
printf "\033[1;3s" # set scroll region left/right
printf "\033[1;3r" # set scroll region top/bottom
printf "\033[3;1H" # Move to bottom left
printf "\033D" # index
```
```
|AAAAAA____|
|AAAAAA____|
|c__AAA____|
```

View File

@ -1,21 +0,0 @@
import Image from "next/image";
import Link from "next/link";
import "@/styles/code.css";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div className="max-w-[850px] justify-center ml-auto mr-auto">
<div className="mt-4 mb-4">
<Link href="/">
<Image src="/icon.png" width={50} height={50} alt="Ghostty Logo" />
</Link>
</div>
<div className="font-mono">
<div className="max-w-full prose prose-h1:text-base prose-h1:font-bold prose-h2:text-base prose-h2:font-bold prose-h3:text-base prose-h3:font-bold prose-p:text-base prose-h1:m-0 prose-h1:mb-1.5 prose-h2:m-0 prose-h2:mb-1.5 prose-h3:m-0 prose-h3:mb-1.5 prose-invert">
{children}
</div>
</div>
</div>
);
}

View File

@ -1,10 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Linefeed (LF)
<VTSequence sequence="LF" />
This is an alias for [index (IND)](/vt/ind).
If [linefeed mode (mode 20)](#TODO) is enabled, perform a
[carriage return](/vt/cr) after the IND operation.

View File

@ -1,70 +0,0 @@
import VTMode from "@/components/VTMode";
# Select 80 or 132 Columns per Page (DECCOLM)
<VTMode value={3} />
Sets the screen to 132 columns if set or 80 columns if unset.
This requires [`132COLS` (DEC mode 40)](/vt/modes/132cols) to be set
to have any effect. If `132COLS` is not set, then setting or unsetting
this mode does nothing.
When this mode changes, the screen is resized to the given column amount,
performing reflow if necessary. If the GUI window is too narrow or too wide,
it is typically resized to fit the explicit column count or a scrollbar is
used. If the GUI window is manually resized (i.e. with the mouse), the column
width of DECCOLM is not enforced.
The scroll margins are reset to their default values given the new screen size.
The cursor is moved to the top-left. The screen is erased using
[erase display (ED) with command 2](/vt/ed).
## Validation
### DECCOLM V-1: Disabled
```bash
printf "ABC\n"
printf "\033[?40l" # disable mode 3
printf "\033[?3h"
printf "X"
```
```
|ABC_____|
|Xc______|
|________|
```
The command should be completely ignored.
### DECCOLM V-2: Unset (80 Column)
```bash
printf "ABC\n"
printf "\033[?40h" # enable mode 3
printf "\033[?3l" # unset the mode
printf "X"
```
```
|X_______|
```
The screen should be 80 columns wide.
### DECCOLM V-3: Set (132 Column)
```bash
printf "ABC\n"
printf "\033[?40h" # enable mode 3
printf "\033[?3h"
printf "X"
```
```
|X_______|
```
The screen should be 132 columns wide.

View File

@ -1,64 +0,0 @@
import VTMode from "@/components/VTMode";
# Origin (DECOM)
<VTMode value={6} />
Changes the origin of grid coordinates to be relative to the current scroll
region.
When set or unset, this invokes [Cursor Position (CUP)](/vt/cup) with row 1 and
column 1. If origin mode is set, this will position the cursor to the
top-left location of the current scroll region. If origin mode is not set,
this will position the cursor to the top-left location of the screen. The
cursor position will be set even if the origin mode is _unchanged_.
The following commands are affected by origin mode. Please see their
respective documentation for details on how origin mode impacts their
behavior.
- [Carriage Return (CR)](/vt/cr)
- [Cursor Position Set (CUP)](/vt/cup)
- [Cursor Position Report (CPR)](/vt/cpr)
- [Save Cursor (DECSC)](/vt/decsc)
- [Restore Cursor (DECRC)](/vt/decrc)
- [Horizontal Position Absolute (HPA)](/vt/hpa)
- [Vertical Position Absolute (VPA)](/vt/vpa)
- [Horizontal Position Relative (HPR)](/vt/hpr)
- [Vertical Position Relative (VPR)](/vt/vpr)
- [Cursor Backward Tabulation (CBT)](/vt/cbt)
- [Screen Alignment Test (DECALN)](/vt/decaln)
- [Full Reset (RIS)](/vt/ris)
- [Soft Reset (DECSTR)](/vt/decstr)
## Validation
### DECOM V-1: Unset No Margins
```bash
printf "\033[H"
printf "\033[2J"
printf "ABC\n"
printf "\033[?6l"
printf "X"
```
```
|XBC_____|
|________|
```
### DECOM V-1: Set No Margins
```bash
printf "\033[H"
printf "\033[2J"
printf "ABC\n"
printf "\033[?6h"
printf "X"
```
```
|XBC_____|
|________|
```

View File

@ -1,12 +0,0 @@
import VTMode from "@/components/VTMode";
# Slow Scroll (DECSCLM)
<VTMode value={4} />
Enable slow or smooth scrolling.
Typically, slow scrolling will scroll line by line when using scroll
functions (arrow keys, scrollbar, etc.). With this disabling, scrolling
jumps by more lines. This is purely up to the terminal to implement how it
sees fit.

View File

@ -1,11 +0,0 @@
import VTMode from "@/components/VTMode";
# Reverse Video (DECSCNM)
<VTMode value={5} />
Swap the foreground/background colors of cells.
This swaps the foreground and background color of cells when displayed.
This does not physically alter the cell state or cell contents; only the
rendered state is affected.

View File

@ -1,89 +0,0 @@
import VTMode from "@/components/VTMode";
# Insert
<VTMode value={4} ansi={true} />
When enabled, text is written to the cell under the cursor
and all existing content is shifted right. When disabled, text
overwrites existing content.
This mode is unset as part of both [full reset (RIS)](/vt/ris)
and [soft reset (DECSTR)](/vt/decstr).
If a multi-cell character (such as "橋") is shifted so that the cell is split
in half, the multi-cell character can either be clipped or erased.
This mode is typically disabled on terminal startup.
## Validation
### INSERT V-1: Simple Usage
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "123456"
printf "\033[1G"
printf "\033[4h"
printf "ABC"
```
```
|ABC123456_|
```
### INSERT V-2: Pushing Off the Screen Edge
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${cols}G"
printf "\033[6D"
printf "123456"
printf "\033[6D"
printf "\033[4h"
printf "ABC"
```
```
|____ABC1234|
```
### INSERT V-3: Writing on the Screen Edge
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${cols}G"
printf "\033[6D"
printf "123456"
printf "\033[1D"
printf "\033[4h"
printf "ABC"
```
```
|____12345AB|
|Cc_________|
```
### INSERT V-3: Splitting a Multi-Cell Character
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${cols}G"
printf "\033[6D"
printf "1234橋"
printf "\033[6D"
printf "\033[4h"
printf "A"
```
```
|_____A1234_|
```

View File

@ -1,30 +0,0 @@
import VTMode from "@/components/VTMode";
# Keyboard Action Mode (KAM)
<VTMode value={2} ansi={true} />
Disable all keyboard input.
This mode is unset as part of both [full reset (RIS)](/vt/ris)
and [soft reset (DECSTR)](/vt/decstr).
A poorly behaved terminal program can lock the terminal emulator
using this command. Terminal emulators should provide a mechanism
to reset this or outright disable it.
This mode is typically disabled on terminal startup.
## Validation
### KAM V-1: Disable Keyboard Input
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "Keyboard input is now disabled.\n"
printf "\033[2h"
sleep 5
printf "\033[2l"
printf "Keyboard input is re-enabled.\n"
```

View File

@ -1,30 +0,0 @@
import VTMode from "@/components/VTMode";
# Linefeed
<VTMode value={20} ansi={true} />
When enabled, [LF](/vt/lf), [VF](/vt/vf), [FF](/vt/ff) all add an
automatic [carriage return](/vt/cr) after the linefeed. Additionally,
all `\r` sent from the terminal to the application are replaced by
`\r\n`.
This mode is typically disabled on terminal startup.
## Validation
### LINEFEED V-1: Simple Usage
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "123456"
printf "\033[20h"
printf "\n"
printf "X"
```
```
|123456____|
|Xc________|
```

View File

@ -1,17 +0,0 @@
import VTMode from "@/components/VTMode";
# Send-Receive Mode (SRM)
<VTMode value={12} ansi={true} />
If reset, characters entered by the keyboard are shown on the screen
as well as being sent to the running program. If set, keyboard input
is sent only to the running program and the running program can choose
whether it wants to echo it back.
This mode is typically enabled on terminal startup.
This mode is generally unsupported across most terminals today and
is recommended to be retired.[^1]
[^1]: https://gitlab.gnome.org/GNOME/vte/-/issues/69

View File

@ -1,53 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Repeat Previous Character (REP)
<VTSequence sequence={["CSI", "Pn", "b"]} />
Repeat the previously printed character `n` times.
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.
In xterm, only characters with single byte (less than decimal 256) are
supported. In most other mainstream terminals, any character is supported.
Each repeated character behaves identically to if it was manually typed in.
Therefore, soft-wrapping, margins, etc. all behave the same as if the
character was typed.
The previously printed character is any character that is printed through
any means. The previously printed character is not limited to characters
a user manually types. If there is no previously typed character, this sequence
does nothing.
## Validation
### REP V-1: Simple Usage
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A"
printf "\033[b"
```
```
|AAc_______|
```
### REP V-2: Soft-Wrap
```bash
cols=$(tput cols)
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[${cols}G"
printf "A"
printf "\033[b"
```
```
|_________A|
|Ac________|
```

View File

@ -1,138 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Reverse Index (RI)
<VTSequence sequence={["ESC", "M"]} />
Move the cursor up one cell, scrolling if necessary.
This sequence does not unset the pending wrap state.
If the cursor is exactly on the [top margin](/vt/decstbm) and is within
[left and right margins](/vt/decslrm), invoke [scroll down (SD)](/vt/sd)
with `n = 1`. The operation is complete.
Otherwise, scrolling isn't necessary. Perform a
[cursor up](/vt/cuu) operation with `n = 1`.
## Validation
### RI V-1: No Scroll Region, Top of Screen
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A\n"
printf "B\n"
printf "C\n"
printf "\033[1;1H" # move to top-left
printf "\033M" # reverse index
printf "X"
```
```
|Xc________|
|A_________|
|B_________|
|C_________|
```
### RI V-2: No Scroll Region, Not Top of Screen
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A\n"
printf "B\n"
printf "C\n"
printf "\033[2;1H"
printf "\033M" # reverse index
printf "X"
```
```
|Xc________|
|B_________|
|C_________|
```
### RI V-3: Top/Bottom Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A\n"
printf "B\n"
printf "C\n"
printf "\033[2;3r" # scroll region
printf "\033[2;1H"
printf "\033M" # reverse index
```
```
|A_________|
|c_________|
|B_________|
```
### RI V-4: Outside of Top/Bottom Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "A\n"
printf "B\n"
printf "C\n"
printf "\033[2;3r" # scroll region
printf "\033[1;1H"
printf "\033M" # reverse index
```
```
|A_________|
|B_________|
|C_________|
```
### RI V-5: Left/Right 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[?69h" # enable left/right margins
printf "\033[2;3s" # scroll region left/right
printf "\033[1;2H"
printf "\033M"
```
```
|A_________|
|DBC_______|
|GEF_______|
|_HI_______|
```
### RI V-6: Outside Left/Right 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[?69h" # enable left/right margins
printf "\033[2;3s" # scroll region left/right
printf "\033[2;1H"
printf "\033M"
```
```
|ABC_______|
|DEF_______|
|GHI_______|
```
Cursor on the `A`.

View File

@ -1,30 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Full Reset (RIS)
<VTSequence sequence={["ESC", "c"]} />
Reset the terminal.
The full reset operation does the following:
- Set the cursor shape to the default
- Reset the scroll region to the full screen
- Disable [left and right margin mode (mode 69)](#TODO)
- Disable [origin mode (mode 6)](#TODO)
- Unset cursor foreground and background colors
- Reset charsets to the default
- Reset [cursor key mode (DECCKM)](#TODO)
- Reset [disable keyboard input (KAM)](#TODO)
- Reset [application keypad mode](/vt/deckpnm)
- Reset xterm keyboard modifier state to the default
- Disable cursor [protected attribute](#TODO)
- Disable any [protected area](#TODO)
- Reset all [mouse tracking modes](#TODO)
- Reset tabstops to default
- Enable [send-receive mode (mode 12)](#TODO)
- Reset [backspace sends delete (mode 67)](#TODO)
- Return to the primary screen and clear it
- Move the cursor to the top-left corner
- Reset the pending wrap state
- Reset saved cursor state

View File

@ -1,37 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Scroll Down (SD)
<VTSequence sequence={["CSI", "Pn", "T"]} />
Inserts `n` lines at the top of the scroll region and shift existing
lines down.
This sequence is functionally identical to
[Insert Line (IL)](/vt/il) with the cursor position set to the top of
the scroll region. The cursor position after the operation must be unchanged
from when SD was invoked.
This sequence unsets the pending wrap state.
## Validation
### SD V-1: Outside of Top/Bottom 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[T"
```
```
|ABC_____|
|DEF_____|
|________|
|GHI_____|
```

View File

@ -1,113 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Scroll Up (SU)
<VTSequence sequence={["CSI", "Pn", "S"]} />
Remove `n` lines from the top of the scroll region and shift existing
lines up.
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.
This sequence executes [Delete Line (DL)](/vt/dl) with the cursor position
set to the top of the scroll region. There are some differences from DL
which are explained below.
The cursor position after the operation must be unchanged from when SU was
invoked. The pending wrap state is _not_ reset.
## Validation
### SU V-1: Simple Usage
```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[S"
```
```
|DEF_____|
|GHI_____|
```
### SU V-2: Top/Bottom 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[2;3r" # scroll region top/bottom
printf "\033[1;1H"
printf "\033[S"
```
```
|ABC_____|
|GHI_____|
```
### SU V-3: 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[S"
```
```
|AEF423__|
|DHI756__|
|G___89__|
```
### SU V-4: Preserves Pending Wrap
```bash
cols=$(tput cols)
printf "\033[1;${cols}H" # move to top-right
printf "\033[2J" # clear screen
printf "A"
printf "\033[2;${cols}H"
printf "B"
printf "\033[3;${cols}H"
printf "C"
printf "\033[S"
printf "X"
```
```
|_______B|
|_______C|
|________|
|X_______|
```
### SU V-5: Scroll Full Top/Bottom Scroll Region
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "top"
printf "\033[5;1H"
printf "ABCDEF"
printf "\033[2;5r" # scroll region top/bottom
printf "\033[4S"
```
```
|top_____|
```

View File

@ -1,8 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Tab (TAB)
<VTSequence sequence="TAB" />
This is an alias for [cursor horizontal tabulation (CHT)](/vt/cht) with
`n = 1`.

View File

@ -1,47 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Tab Clear (TBC)
<VTSequence sequence={["CSI", "Pn", "g"]} />
Clear one or all tab stops.
The parameter `n` must be `0` or `3`. If `n` is omitted, `n` defaults to `0`.
If the parameter `n` is `0`, the cursor column position is marked as
not a tab stop. If the column was already not a tab stop, this does nothing.
If the parameter `n` is `3`, all tab stops are cleared.
## Validation
### TBC V-1: Tab Clear Single
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?W" # reset tabs
printf "\t"
printf "\033[g"
printf "\033[1G"
printf "\t"
```
```
|_______________c_______|
```
### TBC V-3: Clear All Tabstops
```bash
printf "\033[1;1H" # move to top-left
printf "\033[0J" # clear screen
printf "\033[?W" # reset tabs
printf "\033[3g"
printf "\033[1G"
printf "\t"
```
```
|______________________c|
```

View File

@ -1,14 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Vertical Position Absolute (VPA)
<VTSequence sequence={["CSI", "Py", "d"]} />
This sequence performs [cursor position (CUP)](/vt/cup) with `y` set
to the parameterized value and `x` set to the current cursor position.
There is no additional or different behavior for using `VPA`.
Because this invokes `CUP`, the cursor column (`y`) can change if it is
outside the bounds of the `CUP` operation. For example, if
[origin mode](#TODO) is set and the current cursor position is outside
of the scroll region, the column will be adjusted.

View File

@ -1,17 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Vertical Position Relative (VPR)
<VTSequence sequence={["CSI", "Py", "e"]} />
This sequence performs [cursor position (CUP)](/vt/cup) with `y` set
to the current cursor row plus `y` and `x` set to the current cursor column.
There is no additional or different behavior for using `VPR`.
The parameter `y` must be an integer greater than or equal to 1. If `y` is less than
or equal to 0, adjust `y` to be 1. If `y` is omitted, `y` defaults to 1.
Because this invokes `CUP`, the cursor column (`x`) can change if it is
outside the bounds of the `CUP` operation. For example, if
[origin mode](#TODO) is set and the current cursor position is outside
of the scroll region, the column will be adjusted.

View File

@ -1,41 +0,0 @@
import VTSequence from "@/components/VTSequence";
# Set Shift-Escape (XTSHIFTESCAPE)
<VTSequence sequence={["CSI", ">", "Pn", "s"]} />
Configure whether mouse reports are allowed to capture the `shift` modifier.
The parameter `n` must be an integer equal to 0 or 1. If `n` is omitted,
`n` defaults to 0. If `n` is an invalid value, this sequence does nothing.
When a terminal program requests [mouse reporting](#TODO), some mouse
reporting modes also report the modifier keys that are pressed (control, shift,
etc.). This would disable the ability for a terminal user to natively select
text if they typically select text using left-click and drag, since the
left-click event is captured by the running program.
To get around this limitation, many terminal emulators (including xterm)
use the `shift` modifier to disable mouse reporting temporarily, allowing
native text selection to work. In this scenario, however, the running
terminal program cannot detect shift-clicks because the terminal emulator
captures the event.
This sequence (`XTSHIFTESCAPE`) allows configuring this behavior. If
`n` is `0`, the terminal is allowed to override the shift key and not pass
it through to the terminal program. If `n` is `1`, the terminal program
is requesting that the shift modifier is sent using standard mouse
reporting formats.
In either case, the terminal emulator is not forced to respect this request.
For example, `xterm` has a `never` and `always` terminal configuration
to never allow terminal programs to capture shift or to always allow them,
respectively. If either of these configurations are set, `XTSHIFTESCAPE`
has zero effect.
`xterm` also has `false` and `true` terminal configurations. In the `false`
scenario, the terminal emulator will override `shift` (not allow the terminal
program to see it) _unless it is explicitly requested_ via `XTSHIFTESCAPE`.
The `true` scenario is the exact opposite: pass the shift modifier through
to the running terminal program unless the terminal program explicitly states
it doesn't need to know about it (`n = 0`).

View File

@ -1,18 +0,0 @@
export default function VTMode({
value,
ansi = false,
}: {
value: number;
ansi: boolean;
}) {
return (
<div className="flex my-2.5">
<div className="border px-1 grid grid-rows-2 grid-cols-1 text-center">
<div>
{ansi ? "" : "?"}
{value}
</div>
</div>
</div>
);
}

View File

@ -1,52 +0,0 @@
// Draw a diagram showing the VT sequence.
//
// There are some special sequence elements that can be used:
//
// - CSI will be replaced with ESC [.
// - Pn will be considered a parameter
//
export default function VTSequence({
sequence,
}: {
sequence: string | [string];
}) {
let arr: [string] = typeof sequence === "string" ? [sequence] : sequence;
if (arr[0] === "CSI") {
arr.shift();
arr.unshift("ESC", "[");
}
return (
<div className="flex my-2.5">
{arr.map((elem, i) => (
<div key={`${i}${elem}`} className="shrink">
<VTElem elem={elem} />
</div>
))}
</div>
);
}
function VTElem({ elem }: { elem: string }) {
const param = elem.length > 1 && elem[0] === "P";
elem = param ? elem[1] : elem;
const specialChar = special[elem] ?? elem.charCodeAt(0);
const hex = specialChar.toString(16).padStart(2, "0").toUpperCase();
return (
<div className="border px-1 grid grid-rows-2 grid-cols-1 text-center">
<div>{param ? "____" : `0x${hex}`}</div>
<div>{elem}</div>
</div>
);
}
const special: { [key: string]: number } = {
BEL: 0x07,
BS: 0x08,
TAB: 0x09,
LF: 0x0a,
CR: 0x0d,
ESC: 0x1b,
};

View File

@ -1,7 +0,0 @@
import type { MDXComponents } from "mdx/types";
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components,
};
}

View File

@ -1,28 +0,0 @@
import remarkGfm from "remark-gfm";
import remarkToc from "remark-toc";
import rehypePrettyCode from "rehype-pretty-code";
import rehypeSlug from "rehype-slug";
import createMDX from "@next/mdx";
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],
};
/** @type {import('rehype-pretty-code').Options} */
const prettyCodeOptions = {
theme: {
dark: "one-dark-pro",
light: "one-dark-pro", // todo: when we support light mode
},
};
const withMDX = createMDX({
// Add markdown plugins here, as desired
options: {
remarkPlugins: [remarkGfm, remarkToc],
rehypePlugins: [rehypeSlug, [rehypePrettyCode, prettyCodeOptions]],
},
});
export default withMDX(nextConfig);

6955
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
{
"name": "website",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.5.4",
"@types/mdx": "^2.0.8",
"next": "13.5.4",
"react": "^18",
"react-dom": "^18",
"rehype-pretty-code": "^0.10.1",
"rehype-slug": "^6.0.0",
"remark-gfm": "^3.0.1",
"remark-toc": "^9.0.0",
"shiki": "^0.14.4"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10",
"eslint": "^8",
"eslint-config-next": "13.5.4",
"postcss": "^8",
"tailwindcss": "^3",
"typescript": "^5"
}
}

View File

@ -1,6 +0,0 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

View File

@ -1,13 +0,0 @@
@media (prefers-color-scheme: dark) {
pre[data-theme="light"],
code[data-theme="light"] {
display: none;
}
}
@media (prefers-color-scheme: light), (prefers-color-scheme: no-preference) {
pre[data-theme="dark"],
code[data-theme="dark"] {
display: none;
}
}

View File

@ -1,20 +0,0 @@
import type { Config } from "tailwindcss";
import tailwindTypography from "@tailwindcss/typography";
const config: Config = {
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
fontFamily: {
sans: ["var(--font-inter)"],
mono: ["var(--font-jetbrains-mono)"],
},
},
},
plugins: [tailwindTypography],
};
export default config;

View File

@ -1,27 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}