-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use something other than ncurses by default #411
Comments
Hi! I agree that One of the reasons it's still the default backend is the input it supports: things like |
@TimonPost is that something Crossterm could provide? @gyscos is there a list of ncurses-only features? Perhaps Rust backends could implement the missing APIs once they're aware of them. |
Crossterm supports those key combinations. I'm sure of windows, though Linux I will have to check. If not, they probably will when the new input parsing library 'anes' is implemented. I will get back to you. |
@Shnatsel, nope, those combinations are not yet supported for Linux. We do support those for windows. In order to make those work, we have to expand our input parser. With a rough estimation, this is going to be done in 2 months. One question though.... who in the world uses those modifiers haha. Like I have never had the urge to use CTRL + INSER for something. So it is the question of useability vs cutting edge (maybe useless) feature support. |
Exotic modifiers get more useful when building complex UIs like IDEs where users can register their own shortcuts, or in terminal games where you may also want a bunch of shortcuts. Though I agree that Ctrl+Ins is not the most common one; the modifier+Fn keys are more popular. Terminal UIs in general are already quite a niche target, uncommon use-cases are ironically not that uncommon. Especially for a base, "foundational" library, treating these features as "useless" may be a bit harsh. |
I am not sure if it is even possible to support those combinations with ANSI code parsing. I will have to research those key combinations. Linux and Mac are quite limited in the advanced key codes they sent. We found out that multiple modifiers are very poorly supported for those systems. |
|
Note that the specific case of Ctrl+Ins may indeed not be detectable - but other combinations, like Ctrl+Del or Alt+Ins should be doable. Running the One thing to note is that this parsing may not be entirely portable, and the actual codes may change between terminals. For example konsole and gnome-terminals will send different codes for some events like Ctrl+F1 (For gnome-terminal |
We do check on different types of ansi strings. However, compared to ncurses it is quite limited. @zrzka, other maintainer of crossterm, wrote https://crates.io/crates/anes, crossterm is going to use this. This crate provides an ansi code parser for events. I am not sure until how far he implemented those kind of combinations. What I do know is that there were some complications that he encountered. @zrzka can you elaborate on this discussion in relation to your work on this crate? And is it possible for us to support those key combinations? |
A problem with using crossterm by default is that it links against a library that's called BearLibTerminal, and that isn't packaged by debian/ubuntu yet it seems like, that would limit the usage quite a bit. Another problem is that ncurses crate links against ncurses 5, and since ncurses 6 have been out quite a number of years it might be time to upgrade. I have started to look at replacing the ncurses dependency with ncursesw and it doesn't look too hard, mostly a lot of busy-work with renaming things slightly, would you be interested in a pull request if I manage to finish something? |
Does it? Cursive does optionally rely on BearLibTerminal, but I don't think crossterm does.
Really? It does look for the
|
Sorry, I got stuff mixed up, I tried different backends and mixed the blt and the crossterm one. I didn't know about the ABI compability between ncurses 5 and 6, that's neat. |
It seems to be officially supported (https://www.gnu.org/software/ncurses/):
|
README states that Cursive uses ncurses backend by default. Sadly Rust bindings for
ncurses
are very problematic from the safety point of view:ncurses
crate is wildly unsound. It simply wraps calls to C functions in Rust functions and declares them safe, with no validation whatsoever. It has format string vulnerabilities, returns invalid UTF-8 in &str, and so much other unsoundness that you can cause pretty much arbitrary memory corruption. It is also unmaintained. See Tracker: All unsafe blocks must be removed and then re-added one by one after careful verification of actual safety. jeaye/ncurses-rs#188pancurses
crate depends onncurses
and inherits the issues.This presents issues from both security and reliability standpoints. Please consider switching to a backend other than ncurses by default. If Rust-only backends are not anticipated to reach parity with ncurses anytime soon, consider using ncursesw crate - I have not audited it, but it seems to be less of a lost cause than
ncurses
crate.The text was updated successfully, but these errors were encountered: