-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Add simple terminfo detection to std::term #6453
Conversation
This should be sufficient for most systems, and (according to terminfo(5)) is SysV compliant, so... good enough?
This should take care of #502, for this most part. |
If you're not reading the terminfo file and checking the capabilities, I don't think the check is accomplishing anything. If we assume that all terminals support at least 8 ANSI colour escape codes, we wouldn't need a check but I don't think we're going to assume that. |
Well std::term advertises itself as ANSI. I figure the existence of a terminfo file is a pretty good indication that the terminal supports color. Not perfect, but better than hardcoding a list of terminals. Elsewise std::term needs to be rewritten to be more generically correct. |
The list of hardcoded terminal names is a very incomplete list of ones supporting the ANSI colour escapes, the presence of a terminfo file doesn't indicate that. The current way is terrible (it doesn't give me colour) but it's not incorrect. |
So should I add real terminfo parsing? |
Well if we're going to use terminfo, we have to read the # colors and use the setaf/setab capabilities to set ANSI colors. It could just be done by shelling out to |
Work begun on http://github.com/cmr/terminfo-rs |
So https://github.com/cmr/terminfo-rs is satisfactorily complete for this, should I add it to libextra, @thestinger? |
@cmr: yes, please! it will be awesome to have proper detection for colours |
Will open a new PR when it's ready. |
`manual_filter_map` and `manual_find_map` changelog: Add `manual_filter_map` and replace `find_map` with `manual_find_map` Replaces rust-lang#6453 Fixes rust-lang#3188 Fixes rust-lang#4193 ~Depends on rust-lang#6567 (to fix an internal lint false positive)~ This replaces `filter_map` and `find_map` with `manual_filter_map` and `manual_find_map` respectively. However, `filter_map` is left in place since it is used for a variety of other cases. See discussion in rust-lang#6453.
This should be sufficient for most systems, and (according to terminfo(5)) is
SysV compliant, so... good enough?