aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-04-29 18:42:12 +0100
committerThomas Adam <thomas@xteddy.org>2015-04-29 18:42:12 +0100
commitc0cf4843e50ae7b123613798c209f30440d73e55 (patch)
tree7e5724f11e8cbfa0a4480a6dacb04fb98ee68246 /tty.c
parent8794562a85ab7221b4ec3b165723faa8ca10db0a (diff)
parent69b8f100b70061ee2520fb30368a955cf39e47db (diff)
downloadrtmux-c0cf4843e50ae7b123613798c209f30440d73e55.tar.gz
rtmux-c0cf4843e50ae7b123613798c209f30440d73e55.tar.bz2
rtmux-c0cf4843e50ae7b123613798c209f30440d73e55.zip
Merge branch 'obsd-master'
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/tty.c b/tty.c
index ee52d038..f6db8e20 100644
--- a/tty.c
+++ b/tty.c
@@ -34,6 +34,7 @@
void tty_read_callback(struct bufferevent *, void *);
void tty_error_callback(struct bufferevent *, short, void *);
+void tty_set_italics(struct tty *);
int tty_try_256(struct tty *, u_char, const char *);
void tty_colours(struct tty *, const struct grid_cell *);
@@ -457,6 +458,21 @@ tty_putn(struct tty *tty, const void *buf, size_t len, u_int width)
}
void
+tty_set_italics(struct tty *tty)
+{
+ const char *s;
+
+ if (tty_term_has(tty->term, TTYC_SITM)) {
+ s = options_get_string(&global_options, "default-terminal");
+ if (strcmp(s, "screen") != 0 && strncmp(s, "screen-", 7) != 0) {
+ tty_putcode(tty, TTYC_SITM);
+ return;
+ }
+ }
+ tty_putcode(tty, TTYC_SMSO);
+}
+
+void
tty_set_title(struct tty *tty, const char *title)
{
if (!tty_term_has(tty->term, TTYC_TSL) ||
@@ -1396,12 +1412,8 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
tty_putcode(tty, TTYC_BOLD);
if (changed & GRID_ATTR_DIM)
tty_putcode(tty, TTYC_DIM);
- if (changed & GRID_ATTR_ITALICS) {
- if (tty_term_has(tty->term, TTYC_SITM))
- tty_putcode(tty, TTYC_SITM);
- else
- tty_putcode(tty, TTYC_SMSO);
- }
+ if (changed & GRID_ATTR_ITALICS)
+ tty_set_italics(tty);
if (changed & GRID_ATTR_UNDERSCORE)
tty_putcode(tty, TTYC_SMUL);
if (changed & GRID_ATTR_BLINK)