Debian Codegraph @

Xtermina/README.md

raw symbols SCIP
1 # Termina
2
3 [![Crates.io](https://img.shields.io/crates/v/termina.svg)](https://crates.io/crates/termina)
4 [![Documentation](https://docs.rs/termina/badge.svg)](https://docs.rs/termina)
5
6 A cross-platform "virtual terminal" (VT) manipulation library.
7
8 Termina works on Windows as well as *NIX, but Windows requires some extra thought to choose the preferred way of handling input.
9
10 Termina is a cross between [Crossterm](https://github.com/crossterm-rs/crossterm) and [TermWiz](https://github.com/wezterm/wezterm/blob/a87358516004a652ad840bc1661bdf65ffc89b43/termwiz/README.md) with a lower level API which exposes escape codes to consuming applications. The aim is to scale well in the long run as terminals introduce VT extensions like the [Kitty Keyboard Protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) or [Contour's Dark/Light mode detection](https://contour-terminal.org/vt-extensions/color-palette-update-notifications/) - requiring minimal changes in Termina and also allowing flexibility in how applications detect and handle these extensions. See `examples/event-read.rs` for a look at a basic API.
11
12 ## Input handling on Windows
13
14 Termina is able to "speak text/VT" on Windows. This is made possible by Microsoft's investment into [ConPTY](https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/). This means that this input mode requires 64-bit Windows 10.0.17763 (released around Fall 2018) or later ([same as WezTerm](https://wezterm.org/install/windows.html)). However, using VT mode on Windows
15 means the terminal you use needs to support the Kitty Keyboard Protocol in order to handle some complex key combinations.
16 Windows Terminal, notably, does not implement this protocol. However, using the VT protocol allows for some newer features to work, such as bracketed paste.
17 This means there is no single answer for which protocol to use - it depends on your use case.
18
19 See feature comparison below.
20
21 | | VTE Mode | Legacy Console Mode |
22 | --------------------------- | ------------------- | ------------------- |
23 | **Kitty Keyboard Protocol** | ✓ | ✕ |
24 | **Extended key events** | terminal-dependent* | ✓ |
25 | **Bracketed paste** | ✓ | ✕ |
26 | **[AltGr] Support** | ✓ | ✕ |
27
28 * VTE mode depends on Kitty Keyboard Protocol support for extended key events.
29
30 [AltGr]: https://en.wikipedia.org/wiki/AltGr_key
31
32 The legacy input reader can be used by enabling the `windows-legacy` feature. See the `event-read` example for usage.
33
34 ## Credit
35
36 Termina contains significant code sourced and/or modified from other projects, especially Crossterm and TermWiz. Credits for various implementations are marked in implementation notes sections. Since all copied code is licensed under MIT, Termina is offered under the MIT license as well at your option.
37
38 <details><summary>Crossterm license...</summary>
39
40 ```
41 MIT License
42
43 Copyright (c) 2019 Timon
44
45 Permission is hereby granted, free of charge, to any person obtaining a copy
46 of this software and associated documentation files (the "Software"), to deal
47 in the Software without restriction, including without limitation the rights
48 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49 copies of the Software, and to permit persons to whom the Software is
50 furnished to do so, subject to the following conditions:
51
52 The above copyright notice and this permission notice shall be included in all
53 copies or substantial portions of the Software.
54
55 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
61 SOFTWARE.
62 ```
63
64 </details>
65
66 <details><summary>TermWiz license...</summary>
67
68 ```
69 MIT License
70
71 Copyright (c) 2018 Wez Furlong
72
73 Permission is hereby granted, free of charge, to any person obtaining a copy
74 of this software and associated documentation files (the "Software"), to deal
75 in the Software without restriction, including without limitation the rights
76 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77 copies of the Software, and to permit persons to whom the Software is
78 furnished to do so, subject to the following conditions:
79
80 The above copyright notice and this permission notice shall be included in all
81 copies or substantial portions of the Software.
82
83 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
86 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
89 SOFTWARE.
90 ```
91
92 </details>
93
94 ## License
95
96 Licensed under either of:
97
98 * Mozilla Public License, v. 2.0, ([LICENSE-MPL](./LICENSE-MPL) or http://mozilla.org/MPL/2.0/)
99 * MIT license ([LICENSE-MIT](./LICENSE-MIT) or https://opensource.org/licenses/MIT)
100
101 at your option.