diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-01-20 08:18:05 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-01-20 08:18:05 +0000 |
commit | e156fa9fc57daf23271e0cea13303c64927c9ed7 (patch) | |
tree | 185cf22f243040a5dbd0769a741b75efc1d9e93e /usr.bin/tmux | |
parent | 9e4cf31ec86b113cbce2c4d7c45448e688420b88 (diff) |
Support blinking cursor mode, both the xterm CSI ?12 h/l and (the
backwards) screen CSI 34 h/l. From Guanpeng Xu.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/input.c | 14 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 5 | ||||
-rw-r--r-- | usr.bin/tmux/tty-term.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 14 |
4 files changed, 27 insertions, 9 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index f22ea03e4a6..32f66a35c71 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.71 2014/10/08 17:35:58 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.72 2015/01/20 08:18:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1342,6 +1342,9 @@ input_csi_dispatch_rm(struct input_ctx *ictx) case 4: /* IRM */ screen_write_mode_clear(&ictx->ctx, MODE_INSERT); break; + case 34: + screen_write_mode_set(&ictx->ctx, MODE_BLINKING); + break; default: log_debug("%s: unknown '%c'", __func__, ictx->ch); break; @@ -1368,6 +1371,9 @@ input_csi_dispatch_rm_private(struct input_ctx *ictx) case 7: /* DECAWM */ screen_write_mode_clear(&ictx->ctx, MODE_WRAP); break; + case 12: + screen_write_mode_clear(&ictx->ctx, MODE_BLINKING); + break; case 25: /* TCEM */ screen_write_mode_clear(&ictx->ctx, MODE_CURSOR); break; @@ -1413,6 +1419,9 @@ input_csi_dispatch_sm(struct input_ctx *ictx) case 4: /* IRM */ screen_write_mode_set(&ictx->ctx, MODE_INSERT); break; + case 34: + screen_write_mode_clear(&ictx->ctx, MODE_BLINKING); + break; default: log_debug("%s: unknown '%c'", __func__, ictx->ch); break; @@ -1439,6 +1448,9 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx) case 7: /* DECAWM */ screen_write_mode_set(&ictx->ctx, MODE_WRAP); break; + case 12: + screen_write_mode_set(&ictx->ctx, MODE_BLINKING); + break; case 25: /* TCEM */ screen_write_mode_set(&ictx->ctx, MODE_CURSOR); break; diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 87d5831335b..b7d9193bdad 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.484 2014/12/09 19:23:35 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.485 2015/01/20 08:18:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -175,6 +175,7 @@ enum tty_code_code { TTYC_CUP, /* cursor_address, cm */ TTYC_CUU, /* parm_up_cursor, UP */ TTYC_CUU1, /* cursor_up, up */ + TTYC_CVVIS, /* cursor_visible, vs */ TTYC_DCH, /* parm_dch, DC */ TTYC_DCH1, /* delete_character, dc */ TTYC_DIM, /* enter_dim_mode, mh */ @@ -600,7 +601,7 @@ struct mode_key_table { #define MODE_WRAP 0x10 /* whether lines wrap */ #define MODE_MOUSE_STANDARD 0x20 #define MODE_MOUSE_BUTTON 0x40 -/* 0x80 unused */ +#define MODE_BLINKING 0x80 #define MODE_MOUSE_UTF8 0x100 #define MODE_MOUSE_SGR 0x200 #define MODE_BRACKETPASTE 0x400 diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index bd0d68bf6fa..3c5e2a7889d 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.35 2014/07/21 10:25:48 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.36 2015/01/20 08:18:04 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -54,6 +54,7 @@ const struct tty_term_code_entry tty_term_codes[NTTYCODE] = { { TTYC_CUP, TTYCODE_STRING, "cup" }, { TTYC_CUU, TTYCODE_STRING, "cuu" }, { TTYC_CUU1, TTYCODE_STRING, "cuu1" }, + { TTYC_CVVIS, TTYCODE_STRING, "cvvis" }, { TTYC_DCH, TTYCODE_STRING, "dch" }, { TTYC_DCH1, TTYCODE_STRING, "dch1" }, { TTYC_DIM, TTYCODE_STRING, "dim" }, diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 55e8c663618..5c418a9bc74 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.170 2014/08/09 07:33:37 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.171 2015/01/20 08:18:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -482,10 +482,14 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s) mode &= ~MODE_CURSOR; changed = mode ^ tty->mode; - if (changed & MODE_CURSOR) { - if (mode & MODE_CURSOR) - tty_putcode(tty, TTYC_CNORM); - else + if (changed & (MODE_CURSOR|MODE_BLINKING)) { + if (mode & MODE_CURSOR) { + if (mode & MODE_BLINKING && + tty_term_has(tty->term, TTYC_CVVIS)) + tty_putcode(tty, TTYC_CVVIS); + else + tty_putcode(tty, TTYC_CNORM); + } else tty_putcode(tty, TTYC_CIVIS); } if (tty->cstyle != s->cstyle) { |