diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-05-22 16:26:09 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-05-22 16:26:09 +0000 |
commit | b2f301f4e2b05764cd80da2ebc08e10605d0eeca (patch) | |
tree | 7f120658df8bbeab3acdffbed47915a4a4f47587 /tty.c | |
parent | 719755574d4c4a5af1b255cb709c9ce8ee62f7ac (diff) | |
download | rtmux-b2f301f4e2b05764cd80da2ebc08e10605d0eeca.tar.gz rtmux-b2f301f4e2b05764cd80da2ebc08e10605d0eeca.tar.bz2 rtmux-b2f301f4e2b05764cd80da2ebc08e10605d0eeca.zip |
Sync OpenBSD patchset 916:
Support DECSCUSR sequence to set the cursor style with two new
terminfo(5) extensions, Cs and Csr. Written by Ailin Nemui.
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.211 2011-05-22 16:25:02 tcunha Exp $ */ +/* $Id: tty.c,v 1.212 2011-05-22 16:26:09 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -69,6 +69,7 @@ tty_init(struct tty *tty, int fd, char *term) if ((path = ttyname(fd)) == NULL) fatalx("ttyname failed"); tty->path = xstrdup(path); + tty->cstyle = 0; tty->ccolour = xstrdup(""); tty->flags = 0; @@ -244,6 +245,12 @@ tty_stop_tty(struct tty *tty) tty_raw(tty, tty_term_string(tty->term, TTYC_SGR0)); tty_raw(tty, tty_term_string(tty->term, TTYC_RMKX)); tty_raw(tty, tty_term_string(tty->term, TTYC_CLEAR)); + if (tty_term_has(tty->term, TTYC_CS1) && tty->cstyle != 0) { + if (tty_term_has(tty->term, TTYC_CSR1)) + tty_raw(tty, tty_term_string(tty->term, TTYC_CSR1)); + else if (tty_term_has(tty->term, TTYC_CS1)) + tty_raw(tty, tty_term_string1(tty->term, TTYC_CS1, 0)); + } tty_raw(tty, tty_term_string(tty->term, TTYC_CR)); tty_raw(tty, tty_term_string(tty->term, TTYC_CNORM)); @@ -429,6 +436,16 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s) else tty_putcode(tty, TTYC_CIVIS); } + if (tty->cstyle != s->cstyle) { + if (tty_term_has(tty->term, TTYC_CS1)) { + if (s->cstyle == 0 && + tty_term_has(tty->term, TTYC_CSR1)) + tty_putcode(tty, TTYC_CSR1); + else + tty_putcode1(tty, TTYC_CS1, s->cstyle); + } + tty->cstyle = s->cstyle; + } if (changed & ALL_MOUSE_MODES) { if (mode & ALL_MOUSE_MODES) { if (mode & MODE_MOUSE_UTF8) |