Skip to content

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

Open
gerstner-hub wants to merge 3 commits intogentoo:masterfrom
gerstner-hub:master
Open

output.py: support title setting via curses/terminfo#1343
gerstner-hub wants to merge 3 commits intogentoo:masterfrom
gerstner-hub:master

Conversation

@gerstner-hub
Copy link
Copy Markdown

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 <matthias.gerstner@nefkom.net>
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 <matthias.gerstner@nefkom.net>
Comment thread lib/portage/output.py Outdated
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
Copy Markdown
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!

@thesamesam
Copy link
Copy Markdown
Member

I'm sorry, I'd missed this. Is this resolved by 7bfddc6 or 148a62e?

@gerstner-hub
Copy link
Copy Markdown
Author

I'm sorry, I'd missed this. Is this resolved by 7bfddc6 or 148a62e?

Oh, I thought this had already been merged. No wonder it never appeared in production ...

No these commits are unrelated to this topic here. With this PR# the special purpose code for a few specific terminals is replaced by calls to ncurses, this way all terminals that provide proper terminfo files will be transparently supported by portage.

@thesamesam
Copy link
Copy Markdown
Member

Thanks, I'll seek advice from someone well-versed in these affairs and let you know.

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.

3 participants