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
* 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
ignored, this may need to be altered if there are any software terminals
out there that actually need it.
@ -535,4 +538,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other
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>
@ -101,19 +101,19 @@ tty_open(struct tty *tty, char **cause)
#endif
if (init_1string != NULL)
tty_raw(tty, init_1string);
tty_puts(tty, init_1string);
if (init_2string != NULL)
tty_raw(tty, init_2string);
tty_puts(tty, init_2string);
if (init_3string != NULL)
tty_raw(tty, init_3string);
tty_puts(tty, init_3string);
if (enter_ca_mode != NULL)
tty_raw(tty, enter_ca_mode);
tty_puts(tty, enter_ca_mode);
if (keypad_xmit != NULL)
tty_raw(tty, keypad_xmit);
tty_puts(tty, keypad_xmit);
if (ena_acs != NULL)
tty_raw(tty, ena_acs);
tty_raw(tty, clear_screen);
tty_puts(tty, ena_acs);
tty_puts(tty, clear_screen);
tty_keys_init(tty);
@ -382,6 +382,11 @@ tty_putc(struct tty *tty, char ch)
void
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, title);
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);
switch (ch) {
case '\n': /* LF */
tty_puts(tty, cursor_down);
tty_putc(tty, '\n');
break;
case '\r': /* CR */
tty_puts(tty, carriage_return);