1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00

Document supported escape sequences

Fixes #3440.
This commit is contained in:
Christian Duerr 2020-07-03 20:27:18 +00:00 committed by GitHub
parent bc60782e42
commit 09179d06fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 141 additions and 39 deletions

View file

@ -1,3 +1,9 @@
Please make sure to document all user-facing changes in the `CHANGELOG.md` file. Please make sure to document all user-facing changes in the
`CHANGELOG.md` file.
Draft PRs are always welcome, though unless otherwise requested PRs will not be reviewed until all required and optional CI steps are successful and they have left the draft stage. If support for a new escape sequence was added, it should be documented
in `./docs/escape_support.md`.
Draft PRs are always welcome, though unless otherwise requested PRs will
not be reviewed until all required and optional CI steps are successful
and they have left the draft stage.

View file

@ -812,10 +812,6 @@ where
unhandled(params); unhandled(params);
}, },
// Set icon name.
// This is ignored, since alacritty has no concept of tabs.
b"1" => (),
// Set color index. // Set color index.
b"4" => { b"4" => {
if params.len() > 1 && params.len() % 2 != 0 { if params.len() > 1 && params.len() % 2 != 0 {
@ -970,6 +966,9 @@ where
('A', None) => { ('A', None) => {
handler.move_up(Line(arg_or_default!(idx: 0, default: 1) as usize)); handler.move_up(Line(arg_or_default!(idx: 0, default: 1) as usize));
}, },
('B', None) | ('e', None) => {
handler.move_down(Line(arg_or_default!(idx: 0, default: 1) as usize))
},
('b', None) => { ('b', None) => {
if let Some(c) = self.state.preceding_char { if let Some(c) = self.state.preceding_char {
for _ in 0..arg_or_default!(idx: 0, default: 1) { for _ in 0..arg_or_default!(idx: 0, default: 1) {
@ -979,24 +978,27 @@ where
debug!("tried to repeat with no preceding char"); debug!("tried to repeat with no preceding char");
} }
}, },
('B', None) | ('e', None) => { ('C', None) | ('a', None) => {
handler.move_down(Line(arg_or_default!(idx: 0, default: 1) as usize)) handler.move_forward(Column(arg_or_default!(idx: 0, default: 1) as usize))
}, },
('c', None) if arg_or_default!(idx: 0, default: 0) == 0 => { ('c', None) if arg_or_default!(idx: 0, default: 0) == 0 => {
handler.identify_terminal(writer) handler.identify_terminal(writer)
}, },
('C', None) | ('a', None) => {
handler.move_forward(Column(arg_or_default!(idx: 0, default: 1) as usize))
},
('D', None) => { ('D', None) => {
handler.move_backward(Column(arg_or_default!(idx: 0, default: 1) as usize)) handler.move_backward(Column(arg_or_default!(idx: 0, default: 1) as usize))
}, },
('d', None) => {
handler.goto_line(Line(arg_or_default!(idx: 0, default: 1) as usize - 1))
},
('E', None) => { ('E', None) => {
handler.move_down_and_cr(Line(arg_or_default!(idx: 0, default: 1) as usize)) handler.move_down_and_cr(Line(arg_or_default!(idx: 0, default: 1) as usize))
}, },
('F', None) => { ('F', None) => {
handler.move_up_and_cr(Line(arg_or_default!(idx: 0, default: 1) as usize)) handler.move_up_and_cr(Line(arg_or_default!(idx: 0, default: 1) as usize))
}, },
('G', None) | ('`', None) => {
handler.goto_col(Column(arg_or_default!(idx: 0, default: 1) as usize - 1))
},
('g', None) => { ('g', None) => {
let mode = match arg_or_default!(idx: 0, default: 0) { let mode = match arg_or_default!(idx: 0, default: 0) {
0 => TabulationClearMode::Current, 0 => TabulationClearMode::Current,
@ -1009,14 +1011,19 @@ where
handler.clear_tabs(mode); handler.clear_tabs(mode);
}, },
('G', None) | ('`', None) => {
handler.goto_col(Column(arg_or_default!(idx: 0, default: 1) as usize - 1))
},
('H', None) | ('f', None) => { ('H', None) | ('f', None) => {
let y = arg_or_default!(idx: 0, default: 1) as usize; let y = arg_or_default!(idx: 0, default: 1) as usize;
let x = arg_or_default!(idx: 1, default: 1) as usize; let x = arg_or_default!(idx: 1, default: 1) as usize;
handler.goto(Line(y - 1), Column(x - 1)); handler.goto(Line(y - 1), Column(x - 1));
}, },
('h', intermediate) => {
for arg in args {
match Mode::from_primitive(intermediate, *arg) {
Some(mode) => handler.set_mode(mode),
None => unhandled!(),
}
}
},
('I', None) => handler.move_forward_tabs(arg_or_default!(idx: 0, default: 1)), ('I', None) => handler.move_forward_tabs(arg_or_default!(idx: 0, default: 1)),
('J', None) => { ('J', None) => {
let mode = match arg_or_default!(idx: 0, default: 0) { let mode = match arg_or_default!(idx: 0, default: 0) {
@ -1045,13 +1052,6 @@ where
handler.clear_line(mode); handler.clear_line(mode);
}, },
('S', None) => handler.scroll_up(Line(arg_or_default!(idx: 0, default: 1) as usize)),
('t', None) => match arg_or_default!(idx: 0, default: 1) as usize {
22 => handler.push_title(),
23 => handler.pop_title(),
_ => unhandled!(),
},
('T', None) => handler.scroll_down(Line(arg_or_default!(idx: 0, default: 1) as usize)),
('L', None) => { ('L', None) => {
handler.insert_blank_lines(Line(arg_or_default!(idx: 0, default: 1) as usize)) handler.insert_blank_lines(Line(arg_or_default!(idx: 0, default: 1) as usize))
}, },
@ -1064,24 +1064,6 @@ where
} }
}, },
('M', None) => handler.delete_lines(Line(arg_or_default!(idx: 0, default: 1) as usize)), ('M', None) => handler.delete_lines(Line(arg_or_default!(idx: 0, default: 1) as usize)),
('X', None) => {
handler.erase_chars(Column(arg_or_default!(idx: 0, default: 1) as usize))
},
('P', None) => {
handler.delete_chars(Column(arg_or_default!(idx: 0, default: 1) as usize))
},
('Z', None) => handler.move_backward_tabs(arg_or_default!(idx: 0, default: 1)),
('d', None) => {
handler.goto_line(Line(arg_or_default!(idx: 0, default: 1) as usize - 1))
},
('h', intermediate) => {
for arg in args {
match Mode::from_primitive(intermediate, *arg) {
Some(mode) => handler.set_mode(mode),
None => unhandled!(),
}
}
},
('m', None) => { ('m', None) => {
if args.is_empty() { if args.is_empty() {
handler.terminal_attribute(Attr::Reset); handler.terminal_attribute(Attr::Reset);
@ -1097,6 +1079,9 @@ where
('n', None) => { ('n', None) => {
handler.device_status(writer, arg_or_default!(idx: 0, default: 0) as usize) handler.device_status(writer, arg_or_default!(idx: 0, default: 0) as usize)
}, },
('P', None) => {
handler.delete_chars(Column(arg_or_default!(idx: 0, default: 1) as usize))
},
('q', Some(b' ')) => { ('q', Some(b' ')) => {
// DECSCUSR (CSI Ps SP q) -- Set Cursor Style. // DECSCUSR (CSI Ps SP q) -- Set Cursor Style.
let style = match arg_or_default!(idx: 0, default: 0) { let style = match arg_or_default!(idx: 0, default: 0) {
@ -1118,8 +1103,19 @@ where
handler.set_scrolling_region(top, bottom); handler.set_scrolling_region(top, bottom);
}, },
('S', None) => handler.scroll_up(Line(arg_or_default!(idx: 0, default: 1) as usize)),
('s', None) => handler.save_cursor_position(), ('s', None) => handler.save_cursor_position(),
('T', None) => handler.scroll_down(Line(arg_or_default!(idx: 0, default: 1) as usize)),
('t', None) => match arg_or_default!(idx: 0, default: 1) as usize {
22 => handler.push_title(),
23 => handler.pop_title(),
_ => unhandled!(),
},
('u', None) => handler.restore_cursor_position(), ('u', None) => handler.restore_cursor_position(),
('X', None) => {
handler.erase_chars(Column(arg_or_default!(idx: 0, default: 1) as usize))
},
('Z', None) => handler.move_backward_tabs(arg_or_default!(idx: 0, default: 1)),
_ => unhandled!(), _ => unhandled!(),
} }
} }

100
docs/escape_support.md Normal file
View file

@ -0,0 +1,100 @@
# Escape Sequence Support
This list includes all escape sequences Alacritty currently supports.
### Legend
The available statuses are `PARTIAL`, `IMPLEMENTED` and `REJECTED`. While a
status of `PARTIAL` means there is still work left to be done, a status of
`IMPLEMENTED` for something partially implemented means all other features were
rejected.
All whitespace in escape sequences is solely for formatting purposes and all
relevant spaces are denoted as `SP`. The escape parameters are omitted for
brevity.
### ESC codes - `ESC`
| ESCAPE | STATUS | NOTE |
| --------- | ----------- | -------------------------------------------------- |
| `ESC (` | IMPLEMENTED | Only charsets `B` and `0` are supported |
| `ESC )` | IMPLEMENTED | Only charsets `B` and `0` are supported |
| `ESC *` | IMPLEMENTED | Only charsets `B` and `0` are supported |
| `ESC +` | IMPLEMENTED | Only charsets `B` and `0` are supported |
| `ESC =` | IMPLEMENTED | |
| `ESC >` | IMPLEMENTED | |
| `ESC 7` | IMPLEMENTED | |
| `ESC 8` | IMPLEMENTED | |
| `ESC # 8` | IMPLEMENTED | |
| `ESC D` | IMPLEMENTED | |
| `ESC E` | IMPLEMENTED | |
| `ESC H` | IMPLEMENTED | |
| `ESC M` | IMPLEMENTED | |
| `ESC Z` | IMPLEMENTED | |
### CSI (Control Sequence Introducer) - `ESC [`
| ESCAPE | STATUS | NOTE |
| ---------- | ----------- | ------------------------------------------------- |
| ``CSI ` `` | IMPLEMENTED | |
| `CSI @` | IMPLEMENTED | |
| `CSI A` | IMPLEMENTED | |
| `CSI a` | IMPLEMENTED | |
| `CSI B` | IMPLEMENTED | |
| `CSI b` | IMPLEMENTED | |
| `CSI C` | IMPLEMENTED | |
| `CSI c` | PARTIAL | No parameter support |
| `CSI D` | IMPLEMENTED | |
| `CSI d` | IMPLEMENTED | |
| `CSI E` | IMPLEMENTED | |
| `CSI e` | IMPLEMENTED | |
| `CSI F` | IMPLEMENTED | |
| `CSI f` | IMPLEMENTED | |
| `CSI G` | IMPLEMENTED | |
| `CSI g` | IMPLEMENTED | |
| `CSI H` | IMPLEMENTED | |
| `CSI h` | PARTIAL | Only modes `4` and `20` are supported |
| `CSI ? h` | PARTIAL | Supported modes: |
| | | `1`, `3`, `6`, `7`, `12`, `25`, `1000`, `1002` |
| | | `1004`, `1005`, `1006`, `1007`, `1049`, `2004` |
| `CSI I` | IMPLEMENTED | |
| `CSI J` | IMPLEMENTED | |
| `CSI K` | IMPLEMENTED | |
| `CSI L` | IMPLEMENTED | |
| `CSI l` | PARTIAL | See `CSI h` for supported modes |
| `CSI ? l` | PARTIAL | See `CSI ? h` for supported modes |
| `CSI M` | IMPLEMENTED | |
| `CSI m` | PARTIAL | Colon separators are not supported |
| `CSI n` | IMPLEMENTED | |
| `CSI P` | IMPLEMENTED | |
| `CSI SP q` | PARTIAL | No blinking support |
| `CSI r` | IMPLEMENTED | |
| `CSI S` | IMPLEMENTED | |
| `CSI s` | IMPLEMENTED | |
| `CSI T` | IMPLEMENTED | |
| `CSI t` | PARTIAL | Only parameters `22` and `23` are supported |
| `CSI u` | IMPLEMENTED | |
| `CSI X` | IMPLEMENTED | |
| `CSI Z` | IMPLEMENTED | |
### OSC (Operating System Command) - `ESC ]`
| ESCAPE | STATUS | NOTE |
| --------- | ----------- | -------------------------------------------------- |
| `OSC 0` | IMPLEMENTED | Icon names are not supported |
| `OSC 1` | REJECTED | Icon names are not supported |
| `OSC 2` | IMPLEMENTED | |
| `OSC 4` | IMPLEMENTED | |
| `OSC 10` | IMPLEMENTED | |
| `OSC 11` | IMPLEMENTED | |
| `OSC 12` | IMPLEMENTED | |
| `OSC 50` | IMPLEMENTED | Only `CursorShape` is supported |
| `OSC 52` | IMPLEMENTED | Only Clipboard and primary selection supported |
| `OSC 104` | IMPLEMENTED | |
| `OSC 110` | IMPLEMENTED | |
| `OSC 111` | IMPLEMENTED | |
| `OSC 112` | IMPLEMENTED | |
### DCS (Device Control String) - `ESC P`
Alacritty does not support any DCS escapes.