diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-05-30 20:45:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-30 20:45:44 +0000 |
commit | 1dacc99183373bffa3ba287aa3241f3b1da67016 (patch) | |
tree | d5dbefde927b02bff10e29d8596a0bfab65d88f1 /alacritty_terminal/src/ansi.rs | |
parent | f7fb67f870943f3f760826b748c8463b8e434983 (diff) | |
download | alacritty-1dacc99183373bffa3ba287aa3241f3b1da67016.tar.gz alacritty-1dacc99183373bffa3ba287aa3241f3b1da67016.zip |
Refactor Term/Grid separation
This commit aims to clear up the separation between Term and Grid to
make way for implementing search.
The `cursor` and `cursor_save` have been moved to the grid, since
they're always bound to their specific grid and this makes updating
easier.
Since the selection is independent of the active grid, it has been moved
to the `Term`.
Diffstat (limited to 'alacritty_terminal/src/ansi.rs')
-rw-r--r-- | alacritty_terminal/src/ansi.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs index 01f48358..0b196ad5 100644 --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -697,6 +697,51 @@ impl Default for StandardCharset { } } +impl StandardCharset { + /// Switch/Map character to the active charset. Ascii is the common case and + /// for that we want to do as little as possible. + #[inline] + pub fn map(self, c: char) -> char { + match self { + StandardCharset::Ascii => c, + StandardCharset::SpecialCharacterAndLineDrawing => match c { + '`' => '◆', + 'a' => '▒', + 'b' => '\t', + 'c' => '\u{000c}', + 'd' => '\r', + 'e' => '\n', + 'f' => '°', + 'g' => '±', + 'h' => '\u{2424}', + 'i' => '\u{000b}', + 'j' => '┘', + 'k' => '┐', + 'l' => '┌', + 'm' => '└', + 'n' => '┼', + 'o' => '⎺', + 'p' => '⎻', + 'q' => '─', + 'r' => '⎼', + 's' => '⎽', + 't' => '├', + 'u' => '┤', + 'v' => '┴', + 'w' => '┬', + 'x' => '│', + 'y' => '≤', + 'z' => '≥', + '{' => 'π', + '|' => '≠', + '}' => '£', + '~' => '·', + _ => c, + }, + } + } +} + impl<'a, H, W> vte::Perform for Performer<'a, H, W> where H: Handler + TermInfo + 'a, |