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

restore terminal title on exit (xterm) #11910

Merged
merged 1 commit into from Oct 22, 2019

Conversation

@pasenor
Copy link
Contributor

@pasenor pasenor commented Oct 11, 2019

issue #11909

On xterm, there is a terminal "stack" that allows to save and then restore the current terminal title. It allows to reset title to the original value on exit in case it was changed.

@pasenor
Copy link
Contributor Author

@pasenor pasenor commented Oct 15, 2019

Checked the master branch on windows 7, the title is restored on exit, so it seems that the problem shows on xterm only.

@pasenor pasenor force-pushed the restore-terminal-title-xterm branch from de420a1 to 1af9c25 Oct 15, 2019
@Carreau
Copy link
Member

@Carreau Carreau commented Oct 22, 2019

I don't have any objections;

I remember some discussion about that some time ago; and I believe this may garbled the output on some other kind of terminal.

Note that I believe the logic might be perfect in all the case as set_term_title might be called a second time if something change the internal title string. In which case another title is pushed; but only one will be pop'ed at exit.

I believe in the long run we might want to have with title() context manager to make sure we do things properly.

@Carreau Carreau added this to the 7.9 milestone Oct 22, 2019
@Carreau Carreau merged commit 314c1a3 into ipython:master Oct 22, 2019
2 checks passed
@pasenor
Copy link
Contributor Author

@pasenor pasenor commented Oct 23, 2019

I remember some discussion about that some time ago; and I believe this may garbled the output on some other kind of terminal.

Do you have any pointers to that discussion? If restoring the title messes things up, chances are setting the title does too, perhaps we can do something special for such systems.

I believe in the long run we might want to have with title()

Seems sensible, I'll look how to best do it. Is this a theoretical concern, or are there cases where we set the title multiple times?

@Carreau
Copy link
Member

@Carreau Carreau commented Nov 12, 2019

Do you have any pointers to that discussion?
No, just in my memory, I found #10856 as well, but I coudl swear there is more.

Seems sensible, I'll look how to best do it.

That will probably be a lot of refactor; so loooong term.

Or are there cases where we set the title multiple times?

With current code base I believe the title can be set multiple times. But with the proper context manager we should be able to count how many time it was changed from within the context manager and pop the appropriate number of time.

It may even be a feature we want in prompt_toolkit

@pasenor pasenor deleted the restore-terminal-title-xterm branch Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants