1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-23 04:48:47 +00:00

Only set title if TERM looks vaguely okay. Also use newline for, er, newline rather than cursor_down.

This commit is contained in:
Nicholas Marriott 2008-06-21 13:11:28 +00:00
parent 91e5e9290d
commit 456ff329c3
2 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,8 @@
21 June 2008 21 June 2008
* Only attempt to set the title where TERM looks like an xterm (contains
"xterm", "rxvt" or is "screen"). I hate this but I don't see a better way:
setting the title actually kills some other terminals pretty much dead.
* Strip padding out of terminfo(5) strings. Currently the padding is just * Strip padding out of terminfo(5) strings. Currently the padding is just
ignored, this may need to be altered if there are any software terminals ignored, this may need to be altered if there are any software terminals
out there that actually need it. out there that actually need it.
@ -535,4 +538,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other (including mutt, emacs). No status bar yet and no key remapping or other
customisation. customisation.
$Id: CHANGES,v 1.133 2008-06-21 12:41:04 nicm Exp $ $Id: CHANGES,v 1.134 2008-06-21 13:11:28 nicm Exp $

23
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.32 2008-06-21 12:41:26 nicm Exp $ */ /* $Id: tty.c,v 1.33 2008-06-21 13:11:28 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -101,19 +101,19 @@ tty_open(struct tty *tty, char **cause)
#endif #endif
if (init_1string != NULL) if (init_1string != NULL)
tty_raw(tty, init_1string); tty_puts(tty, init_1string);
if (init_2string != NULL) if (init_2string != NULL)
tty_raw(tty, init_2string); tty_puts(tty, init_2string);
if (init_3string != NULL) if (init_3string != NULL)
tty_raw(tty, init_3string); tty_puts(tty, init_3string);
if (enter_ca_mode != NULL) if (enter_ca_mode != NULL)
tty_raw(tty, enter_ca_mode); tty_puts(tty, enter_ca_mode);
if (keypad_xmit != NULL) if (keypad_xmit != NULL)
tty_raw(tty, keypad_xmit); tty_puts(tty, keypad_xmit);
if (ena_acs != NULL) if (ena_acs != NULL)
tty_raw(tty, ena_acs); tty_puts(tty, ena_acs);
tty_raw(tty, clear_screen); tty_puts(tty, clear_screen);
tty_keys_init(tty); tty_keys_init(tty);
@ -382,6 +382,11 @@ tty_putc(struct tty *tty, char ch)
void void
tty_set_title(struct tty *tty, const char *title) tty_set_title(struct tty *tty, const char *title)
{ {
if (strstr(tty->termname, "xterm") == NULL &&
strstr(tty->termname, "rxvt") == NULL &&
strcmp(tty->termname, "screen") != 0)
return;
tty_puts(tty, "\e]0;"); tty_puts(tty, "\e]0;");
tty_puts(tty, title); tty_puts(tty, title);
tty_putc(tty, '\007'); tty_putc(tty, '\007');
@ -405,7 +410,7 @@ tty_vwrite(struct tty *tty, struct screen *s, int cmd, va_list ap)
ch = va_arg(ap, int); ch = va_arg(ap, int);
switch (ch) { switch (ch) {
case '\n': /* LF */ case '\n': /* LF */
tty_puts(tty, cursor_down); tty_putc(tty, '\n');
break; break;
case '\r': /* CR */ case '\r': /* CR */
tty_puts(tty, carriage_return); tty_puts(tty, carriage_return);