Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Add simple terminfo detection to std::term #6453

wants to merge 1 commit into from

Conversation

emberian
Copy link
Member

This should be sufficient for most systems, and (according to terminfo(5)) is
SysV compliant, so... good enough?

This should be sufficient for most systems, and (according to terminfo(5)) is
SysV compliant, so... good enough?
@emberian
Copy link
Member Author

This should take care of #502, for this most part.

@thestinger
Copy link
Contributor

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.

@emberian
Copy link
Member Author

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.

@thestinger
Copy link
Contributor

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.

@emberian
Copy link
Member Author

So should I add real terminfo parsing?

@thestinger
Copy link
Contributor

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 tput, but parsing it would be faster.

@emberian
Copy link
Member Author

Work begun on http://github.com/cmr/terminfo-rs

@emberian
Copy link
Member Author

So https://github.com/cmr/terminfo-rs is satisfactorily complete for this, should I add it to libextra, @thestinger?

@thestinger
Copy link
Contributor

@cmr: yes, please! it will be awesome to have proper detection for colours

@emberian emberian closed this May 25, 2013
@emberian
Copy link
Member Author

Will open a new PR when it's ready.

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 30, 2021
`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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants