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

output.py: support title setting via curses/terminfo #1343

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gerstner-hub
Copy link

To support terminal title setting for a broader range of terminals, implement curses/terminfo support for setting terminal titles, instead of relying only on the hard coded list of supported $TERM values.

Currently only the list of hard coded terminal names found in
_legal_terms_re allow usage of the title setting feature. Maintaining
this list is a burden and means that some terminals will miss out this
feature, although they actually do have support for it.

Thus, try to use the curses module to dynamically query the terminfo
database for "tsl" (to status line) and "fsl" (from status line)
strings. This way all terminals that declare support for the feature
will automatically benefit.

As a fallback, should curses not be available, still rely on the
_legal_terms_re for setting up terminal titles.

Signed-off-by: Matthias Gerstner <[email protected]>
The global variables are inconsistently named and spread over the
module, similarly the title related code is not grouped together.
Harmonize this.

Also the double negative logic involving `_disable_xtermTitle` makes the
code harder to read. Invert the logic.

Signed-off-by: Matthias Gerstner <[email protected]>
lib/portage/output.py Outdated Show resolved Hide resolved
sys.stderr is sometimes temporarily replaced by other objects, thus rely
on sys.__stdserr__ consistently. Also provide a default for `fd` in
`init_curses()`.
Copy link
Member

@zmedico zmedico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

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