Re: terminal title after exit
- From: "Yury V. Zaytsev" <yury shurup com>
- To: Joseph Reagle <joseph 2011 reagle org>
- Cc: mc gnome org
- Subject: Re: terminal title after exit
- Date: Tue, 23 Aug 2016 21:20:28 +0200 (CEST)
On Tue, 23 Aug 2016, Joseph Reagle wrote:
On 8/23/16 12:46 PM, Yury V. Zaytsev wrote:
On Tue, 23 Aug 2016, Joseph Reagle wrote:
mc changes the terminal title; I know I can disable this with
xterm_title=0, but I actually don't mind it *if* it restored the
title after I exited...
Hmmm, on Linux the title is restored after mc exits, but it could be
that it is done by bash or vte, rather than mc. Is there any such
feature request already on Trac?
BTW: this is using homebrew and iTerm2 on Mac.
We are not currently saving & restoring the title by ourselves, so it
sounds like iTerm2 on Mac is behaves differently from vte on Linux in this
respect...
Maybe we could do something along the following lines; I haven't even
checked whether this compiles, but what it should do is to push the last
title on the stack the first time it is updated, and the pop it out upon
exiting mc.
I don't know if iTerm2 fully supports the title stack feature, but it has
the potential to work; if you don't want to patch mc, you can try wrapping
the call with
echo -ne '\e[22t'
mc
echo -ne '\e[23t'
If that works, would be nice if you could create a nice feature request on
Trac with all relevant info or maybe even prepare a clean patch?
diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c
index 1a02129..12d4619 100644
--- a/src/filemanager/layout.c
+++ b/src/filemanager/layout.c
@@ -1378,6 +1378,14 @@ update_xterm_title_path (void)
{
if (mc_global.tty.xterm_flag && xterm_title)
{
+
+ static gboolean save_title = TRUE;
+
+ if (save_title) {
+ fprintf (stdout, "\e[22t");
+ save_title = FALSE;
+ }
+
char *p;
char *path;
char *login;
diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c
index 68d12da..6d4f2a8 100644
--- a/src/filemanager/midnight.c
+++ b/src/filemanager/midnight.c
@@ -1047,6 +1047,10 @@ quit_cmd_internal (int quiet)
stop_dialogs ();
}
+ if (mc_global.tty.xterm_flag && xterm_title) {
+ fprintf (stdout, "\e[23t");
+ }
+
if (q != 0)
quit |= 1;
return (quit != 0);
--
Sincerely yours,
Yury V. Zaytsev
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]