termion issueshttps://gitlab.redox-os.org/redox-os/termion/-/issues2024-02-24T00:18:21Zhttps://gitlab.redox-os.org/redox-os/termion/-/issues/198AsFd trait not implemented for AlternateScreen2024-02-24T00:18:21ZJordan MacDonaldAsFd trait not implemented for AlternateScreenI make use of the raw and alternate screen modes _together_, and the changes that landed in v3.0 break this:
```
error[E0277]: the trait bound `AlternateScreen<Stdout>: AsFd` is not satisfied
--> src/view/terminal/termion_terminal.rs...I make use of the raw and alternate screen modes _together_, and the changes that landed in v3.0 break this:
```
error[E0277]: the trait bound `AlternateScreen<Stdout>: AsFd` is not satisfied
--> src/view/terminal/termion_terminal.rs:354:42
|
354 | fn create_output_instance() -> BufWriter<RawTerminal<AlternateScreen<Stdout>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `AsFd` is not implemented for `AlternateScreen<Stdout>`
```
I _think_ this was just an oversight when adding the raw mode improvements, but I'm happy to be corrected if that's not the case. :smile:https://gitlab.redox-os.org/redox-os/termion/-/issues/179Add support for vt102 "Scrolling region"2024-01-04T13:50:16ZLinus ProbertAdd support for vt102 "Scrolling region"I'm currently using your library for a personal project (MUD client). However I still need to send a lot of manual escape data to be able to handle scrolling regions (Think, input area at bottom of terminal (10%) and scrolling 'mud' outp...I'm currently using your library for a personal project (MUD client). However I still need to send a lot of manual escape data to be able to handle scrolling regions (Think, input area at bottom of terminal (10%) and scrolling 'mud' output at the top 90%).
It would be sweet if this could be handled through termion and "obscure" all my escape code logic within termion calls.
I have implemented a solution for this already. Just need to test and confirm. I just wanted to create the issue to keep things orderly and also check if it's even in your interest to add it.https://gitlab.redox-os.org/redox-os/termion/-/issues/196events() does not work with I/O Safety2023-09-23T17:29:26ZAlan Somersevents() does not work with I/O SafetyTermion does not work with Rust's I/O Safety features. The problem is that the TermRead::events method captures by move. That's fine if all of the terminals are represented by RawFds, which allow Copy. But OwnedFd does not, nor does i...Termion does not work with Rust's I/O Safety features. The problem is that the TermRead::events method captures by move. That's fine if all of the terminals are represented by RawFds, which allow Copy. But OwnedFd does not, nor does io::Stdin. That creates a problem when one tries to use TermRead::events in combination with other APIs that expect BorrowedFd or OwnedFd. It would be better if TermRead::events would accept either an OwnedFd by move (and implement AsFd too), or accept a BorrowedFd reference and capture its lifetime.
Here's an example of a program that ought to work, but doesn't.
```rust
extern crate nix;
extern crate termion;
use std::os::fd::AsFd;
use nix::poll::{PollFd, PollFlags, poll};
use termion::input::TermRead;
fn main() {
let stdin = std::io::stdin();
// Create a pollfd, so we can poll for keyboard events with a timeout
let pollfd = PollFd::new(stdin.as_fd(), PollFlags::POLLIN);
// Create a Termion Events object to actually read the events.
// But oh no! events() captures by move.
let mut events = stdin.events();
// Wait for events to arrive
// BUILD FAILS: pollfd borrows stdin, which was already moved.
poll(&mut [pollfd][..], 1000);
// Check what event arrived
dbg!(events.next());
}
```
Here are the compile errors:
```
Checking termion v2.0.1 (/usr/home/somers/src/rust/termion)
error[E0505]: cannot move out of `stdin` because it is borrowed
--> examples/borrowed_fd.rs:17:22
|
10 | let stdin = std::io::stdin();
| ----- binding `stdin` declared here
...
13 | let pollfd = PollFd::new(stdin.as_fd(), PollFlags::POLLIN);
| ----- borrow of `stdin` occurs here
...
17 | let mut events = stdin.events();
| ^^^^^ move out of `stdin` occurs here
...
21 | poll(&mut [pollfd][..], 1000);
| ------ borrow later used here
For more information about this error, try `rustc --explain E0505`.
error: could not compile `termion` (example "borrowed_fd") due to previous error
```https://gitlab.redox-os.org/redox-os/termion/-/issues/194ctrl + arrow?2021-11-12T23:56:34ZAndrzej J. Skalskictrl + arrow?Hi,
how can I add "ctrl + arrow" combination? Is it supported on UNIX/Redox?Hi,
how can I add "ctrl + arrow" combination? Is it supported on UNIX/Redox?https://gitlab.redox-os.org/redox-os/termion/-/issues/193How to set terminal title?2021-10-23T16:44:55ZarkadenwHow to set terminal title?It seems that termion doesn't offer any way to set the terminal title.
For comparison, crossterm has a corresponding `SetTitle` method: https://docs.rs/crossterm/0.22.1/crossterm/terminal/struct.SetTitle.html
Has anyone considered addi...It seems that termion doesn't offer any way to set the terminal title.
For comparison, crossterm has a corresponding `SetTitle` method: https://docs.rs/crossterm/0.22.1/crossterm/terminal/struct.SetTitle.html
Has anyone considered adding such a function?https://gitlab.redox-os.org/redox-os/termion/-/issues/173Getting cursor position still panics2021-09-19T21:10:25ZdoumsGetting cursor position still panicsHi!
I would like to report an old but **big** issue of Termion that still exists:
`cursor_pos()` panics when using stdin in other thread that the one of the call.
The following two examples demonstrate the problem:
Using thread:
```
us...Hi!
I would like to report an old but **big** issue of Termion that still exists:
`cursor_pos()` panics when using stdin in other thread that the one of the call.
The following two examples demonstrate the problem:
Using thread:
```
use std::io;
use std::thread;
use termion::cursor::DetectCursorPos;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
fn main() {
let mut stdout = io::stdout().into_raw_mode().unwrap();
let handle = thread::spawn(|| {
let stdin = io::stdin();
for _input in stdin.keys() {}
});
let (init_a, init_b) = stdout.cursor_pos().unwrap(); //panics !
println!("{}:{}", init_a, init_b);
handle.join().unwrap();
}
```
Using `async_stdin()`
```
use std::io::{self, Read};
use termion::async_stdin;
use termion::cursor::DetectCursorPos;
use termion::raw::IntoRawMode;
fn main() {
let mut stdout = io::stdout().into_raw_mode().unwrap();
let mut stdin = async_stdin().bytes();
let (init_a, init_b) = stdout.cursor_pos().unwrap(); //panics !
println!("{}:{}", init_a, init_b);
}
```
What does that mean ?
Its means that it is actually impossible to retrieve the cursor position when using `async_stdin` or when stdin is used in another thread.
But using stdin in another thread is the only way to handle input events without blocking the current thread, so it is simply a **huge** use case !
Actually I can not believe that a library like Termion has this kind of problem! I mean, this issue greatly limits the usages of the library.
https://gitlab.redox-os.org/redox-os/termion/-/issues/103interest in windows port2021-09-01T05:58:51ZMichael Aaron Murphymmstick@pm.meinterest in windows port*Created by: mrcaron*
I saw a post over here on Windows support for a rust terminal app. One user [responds](https://users.rust-lang.org/t/skim-a-fuzzy-finder-written-in-rust/6390/13) with a post to [heatseeker](https://github.com/rschm...*Created by: mrcaron*
I saw a post over here on Windows support for a rust terminal app. One user [responds](https://users.rust-lang.org/t/skim-a-fuzzy-finder-written-in-rust/6390/13) with a post to [heatseeker](https://github.com/rschmitt/heatseeker), talking about how they did windows tty support. The file's here: https://github.com/rschmitt/heatseeker/blob/master/src/screen/windows.rs. I wonder if this could be any help to making termion work with Windows?https://gitlab.redox-os.org/redox-os/termion/-/issues/178termion windows support in 20202021-09-01T05:58:49ZDennis Jehletermion windows support in 2020Hello, is there any chance that termion will support windows powershell in the next couple of months?Hello, is there any chance that termion will support windows powershell in the next couple of months?https://gitlab.redox-os.org/redox-os/termion/-/issues/192Support Tab key2021-08-19T01:55:41ZNoah GinsburgSupport Tab key`BackTab` is supported but `Tab` is not
It seems like all that's needed for this is to add in the file `event.rs`
`Tab` into the `Key` enum and
`Some(Ok(b'I')) => Event::Key(Key::Tab),` into `parse_csi`
I don't have access rights so I...`BackTab` is supported but `Tab` is not
It seems like all that's needed for this is to add in the file `event.rs`
`Tab` into the `Key` enum and
`Some(Ok(b'I')) => Event::Key(Key::Tab),` into `parse_csi`
I don't have access rights so I can't just give an MR for it.https://gitlab.redox-os.org/redox-os/termion/-/issues/191Input events/key parsing: please add better documentation where hard-coded va...2021-07-14T22:26:13ZPhilipp SchusterInput events/key parsing: please add better documentation where hard-coded values come from for educational purposesHi. In https://gitlab.redox-os.org/redox-os/termion/-/blob/master/src/event.rs#L131 you have lots of important yet hard to understand parsing code for input keys. Especially the "CTRL-"-sequences are hard to understand. Can you maybe add...Hi. In https://gitlab.redox-os.org/redox-os/termion/-/blob/master/src/event.rs#L131 you have lots of important yet hard to understand parsing code for input keys. Especially the "CTRL-"-sequences are hard to understand. Can you maybe add a comment where/in **what specification these values can be found** for educational reasons? Please be more specific than "ANSI escape sequences".
```rust
c @ b'\x01'..=b'\x1A' => Ok(Event::Key(Key::Ctrl((c as u8 - 0x1 + b'a') as char))),
c @ b'\x1C'..=b'\x1F' => Ok(Event::Key(Key::Ctrl((c as u8 - 0x1C + b'4') as char))),
```
- why two ranges for `CTRL-`-key-combinations/shortcuts?
- why substract something from `c`
- why add after that `b'a'`/`b'4'`?https://gitlab.redox-os.org/redox-os/termion/-/issues/123Include color structs (e.g White/Black) into an enum2021-04-26T04:05:44ZMichael Aaron Murphymmstick@pm.meInclude color structs (e.g White/Black) into an enum*Created by: lotabout*
Current all color structs are independent and all implement trait `termion::color::Color`. It had limitations however.
### Example 1
Let's assume we want to store a color object that can be changed later, so w...*Created by: lotabout*
Current all color structs are independent and all implement trait `termion::color::Color`. It had limitations however.
### Example 1
Let's assume we want to store a color object that can be changed later, so we define it as
```rust
let c: Box<Color> = Box::new<color::White;>
```
However, `color::Fg` and `color::Bg` require an object that implements trait `Color`. That means the stored trait object cannot be used with them.
```rust
println!("{}White", color::Fg(*c));
```
It won't work!
### Example 2
Let's assume `color::Bg` and `color::Fg` works this time. Say we are implement some color scheme, so we have struct like:
```rust
pub struct ColorTheme {
highlighted: Box<Color>,
}
```
A common requirement is to allow a color theme to be cloned, so we modify the code as:
```rust
#[derive(clone)]
pub struct ColorTheme {
highlighted: Box<Color>,
}
```
It won't work because `Box<Color>` is an trait object.
### Proposal
1. Perhaps we could require `Clone` for `Color`. Like `trait Color: Clone`.
2. Implement `Color` for `Box<Color>`. So that example 1 could work.
3. Or put all structs into an `enum`.https://gitlab.redox-os.org/redox-os/termion/-/issues/190Mouse support is incomplete2021-04-05T20:43:47ZAndriy SymonovychMouse support is incompleteMouse event API has events for certain button (L, M, R) presses but release event does not carry what exact button is released.
This makes it impossible to handle simultaneous button presses correctly.
Also there seems to be no way to s...Mouse event API has events for certain button (L, M, R) presses but release event does not carry what exact button is released.
This makes it impossible to handle simultaneous button presses correctly.
Also there seems to be no way to stop capturing mouse events (except for sending CSI sequence manually)https://gitlab.redox-os.org/redox-os/termion/-/issues/189cfmakeraw() not portable to many *nix systems2021-03-11T22:16:04ZCorrado Primiercfmakeraw() not portable to many *nix systemsHello,
I tried building termion on SmartOS (a Solaris derivative) but it failed on `cfmakeraw()` being undefined. This is [documented in gnulib](https://www.gnu.org/software/gnulib/manual/html_node/cfmakeraw.html), a good workaround is ...Hello,
I tried building termion on SmartOS (a Solaris derivative) but it failed on `cfmakeraw()` being undefined. This is [documented in gnulib](https://www.gnu.org/software/gnulib/manual/html_node/cfmakeraw.html), a good workaround is [setting the termios flags directly](https://perkin.org.uk/posts/solaris-portability-cfmakeraw.html) on Solaris-like OSs. Could you please fix it?https://gitlab.redox-os.org/redox-os/termion/-/issues/185How to exit raw mode?2021-01-15T00:55:41ZTENXHow to exit raw mode?Like vim does, press `ESC` to enter the raw mode, press `a` to enter the insert mode, how to implement these behaviors with termion?Like vim does, press `ESC` to enter the raw mode, press `a` to enter the insert mode, how to implement these behaviors with termion?https://gitlab.redox-os.org/redox-os/termion/-/issues/188CI: Increase memory limit of docker container for gitlab runner (for redox)2020-12-15T12:42:55Zmatu3baCI: Increase memory limit of docker container for gitlab runner (for redox)Job [#27838](https://gitlab.redox-os.org/redox-os/termion/-/jobs/27838) failed for 189222555ef92a29de366f96d2a067b3a920fc24:
```text
redoxer: copying '.' to '/root'
qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocat...Job [#27838](https://gitlab.redox-os.org/redox-os/termion/-/jobs/27838) failed for 189222555ef92a29de366f96d2a067b3a920fc24:
```text
redoxer: copying '.' to '/root'
qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
## redoxer (failure, qemu exit status ExitStatus(ExitStatus(256)) ##
```
The memory limit of the docker runner appears to be [too low](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1582).https://gitlab.redox-os.org/redox-os/termion/-/issues/167Build fails on Windows2020-11-22T08:09:35ZSebastian ThielBuild fails on WindowsThis is a cross-post from the respective issue in [`disk usage analyzer`](https://github.com/Byron/dua-cli/issues/2), and happens `stable-x86_64-pc-windows-msvc` - `rustc 1.35.0 (3c235d560 2019-05-20)`.
*I thought Termion was working on...This is a cross-post from the respective issue in [`disk usage analyzer`](https://github.com/Byron/dua-cli/issues/2), and happens `stable-x86_64-pc-windows-msvc` - `rustc 1.35.0 (3c235d560 2019-05-20)`.
*I thought Termion was working on windows by now*, and am surprised it fails due to module errors. Maybe these are unrelated?
Thanks for your advice
<details>
```
error[E0433]: failed to resolve: maybe a missing `extern crate sys;`?
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\lib.rs:24:9
|
24 | pub use sys::size::terminal_size;
| ^^^ maybe a missing `extern crate sys;`?
error[E0433]: failed to resolve: maybe a missing `extern crate sys;`?
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\lib.rs:25:9
|
25 | pub use sys::tty::{is_tty, get_tty};
| ^^^ maybe a missing `extern crate sys;`?
error[E0433]: failed to resolve: maybe a missing `extern crate sys;`?
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\async.rs:5:5
|
5 | use sys::tty::get_tty;
| ^^^ maybe a missing `extern crate sys;`?
error[E0433]: failed to resolve: maybe a missing `extern crate sys;`?
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:29:5
|
29 | use sys::attr::{get_terminal_attr, raw_terminal_attr, set_terminal_attr};
| ^^^ maybe a missing `extern crate sys;`?
error[E0432]: unresolved import `sys`
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:28:5
|
28 | use sys::Termios;
| ^^^ maybe a missing `extern crate sys;`?
error[E0425]: cannot find function `get_tty` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\async.rs:14:36
|
14 | thread::spawn(move || for i in get_tty().unwrap().bytes() {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `get_tty` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\async.rs:43:36
|
43 | thread::spawn(move || for i in get_tty().unwrap().bytes() {
| ^^^^^^^ not found in this scope
error[E0425]: cannot find function `set_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:45:9
|
45 | set_terminal_attr(&self.prev_ios).unwrap();
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `get_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:90:23
|
90 | let mut ios = get_terminal_attr()?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `raw_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:93:9
|
93 | raw_terminal_attr(&mut ios);
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `set_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:95:9
|
95 | set_terminal_attr(&ios)?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `set_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:106:9
|
106 | set_terminal_attr(&self.prev_ios)?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `get_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:111:23
|
111 | let mut ios = get_terminal_attr()?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `raw_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:112:9
|
112 | raw_terminal_attr(&mut ios);
| ^^^^^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function `set_terminal_attr` in this scope
--> C:\Users\Roy\.cargo\registry\src\github.com-1ecc6299db9ec823\termion-1.5.2\src\raw.rs:113:9
|
113 | set_terminal_attr(&ios)?;
| ^^^^^^^^^^^^^^^^^ not found in this scope
error: aborting due to 15 previous errors
Some errors occurred: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
error: Could not compile `termion`.
warning: build failed, waiting for other jobs to finish...
```https://gitlab.redox-os.org/redox-os/termion/-/issues/187[RfC] Support for backgrounding an application with Ctrl+Z2020-10-01T05:10:58ZSebastian Thiel[RfC] Support for backgrounding an application with Ctrl+ZThis issue is just for reference of the conversation had over at `crossterm` in case you want to chime in.
https://github.com/crossterm-rs/crossterm/issues/494
Thank youThis issue is just for reference of the conversation had over at `crossterm` in case you want to chime in.
https://github.com/crossterm-rs/crossterm/issues/494
Thank youhttps://gitlab.redox-os.org/redox-os/termion/-/issues/186DetectCursorPos and raw mode2020-09-12T20:58:45ZRobin KrahlDetectCursorPos and raw modeApparently, the `DetectCursorPos` trait only works in raw mode. (At least it always fails if I run it without raw mode.) This should be explained in the API documentation.
If you confirm that this is correct, I can prepare a PR that f...Apparently, the `DetectCursorPos` trait only works in raw mode. (At least it always fails if I run it without raw mode.) This should be explained in the API documentation.
If you confirm that this is correct, I can prepare a PR that fixes the issue.https://gitlab.redox-os.org/redox-os/termion/-/issues/184getch like feature2020-09-05T16:07:50ZGeloxgetch like featureAs far as I can tell there is no way to get getch like behavior as input::Keys will only iterate over keys after the user has pressed enter.
What are some thoughts on exposing just getch from libc to the public API?
If it is not clear ...As far as I can tell there is no way to get getch like behavior as input::Keys will only iterate over keys after the user has pressed enter.
What are some thoughts on exposing just getch from libc to the public API?
If it is not clear what the purpose of this is. It seems like a lot of TUI applications want to be able to record key-strokes in order to react without requiring the user to press enter.https://gitlab.redox-os.org/redox-os/termion/-/issues/168[question] async_stdin and keys()2020-09-02T18:20:34Zdoums[question] async_stdin and keys()Hi,
I noted that while being in `async_stdin` "mod" the `keys()` method does not return proper events. For example if I use the code below, `Left` key is not recognized. If I use `let mut it = stdin.keys()` instead of `termion::async_st...Hi,
I noted that while being in `async_stdin` "mod" the `keys()` method does not return proper events. For example if I use the code below, `Left` key is not recognized. If I use `let mut it = stdin.keys()` instead of `termion::async_stdin()` this works well. Can someone explain me why ?
```
use std::io;
use std::io::{stdin, stdout, Read, Write};
use termion;
use termion::event::Key;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
fn main() -> Result<(), io::Error> {
let mut stdout = io::stdout().into_raw_mode()?;
let mut stdin = termion::async_stdin();
// let mut stdin = io::stdin();
let mut it = stdin.keys();
loop {
let b = it.next();
if let Some(event) = b {
match event? {
Key::Left => println!("LEFT"),
Key::Char('q') => break,
_ => {}
}
}
stdout.flush()?;
}
Ok(())
}
```