diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-05-22 16:25:02 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-05-22 16:25:02 +0000 |
commit | 719755574d4c4a5af1b255cb709c9ce8ee62f7ac (patch) | |
tree | 03810384ca0e94bbe93d9185ae77a1e8578c7be6 /input.c | |
parent | 89f35125b4eb5c032f57e8acb70274b77e887f0b (diff) |
Sync OpenBSD patchset 915:
Support xterm(1) cursor colour change sequences through terminfo(5) Cc
(set) and Cr (reset) extensions. Originally by Sean Estabrooks, tweaked
by me and Ailin Nemui.
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 38 |
1 files changed, 30 insertions, 8 deletions
@@ -1,4 +1,4 @@ -/* $Id: input.c,v 1.117 2011-03-19 23:30:37 tcunha Exp $ */ +/* $Id: input.c,v 1.118 2011-05-22 16:25:02 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1445,17 +1445,39 @@ input_enter_osc(struct input_ctx *ictx) void input_exit_osc(struct input_ctx *ictx) { - if (ictx->flags & INPUT_DISCARD) - return; - log_debug("%s: \"%s\"", __func__, ictx->input_buf); + u_char *p = ictx->input_buf; + int option; - if (ictx->input_len < 2 || ictx->input_buf[1] != ';') + if (ictx->flags & INPUT_DISCARD) return; - if (ictx->input_buf[0] != '0' && ictx->input_buf[0] != '2') + if (ictx->input_len < 1 || *p < '0' || *p > '9') return; - screen_set_title(ictx->ctx.s, ictx->input_buf + 2); - server_status_window(ictx->wp->window); + log_debug("%s: \"%s\"", __func__, p); + + option = 0; + while (*p >= '0' && *p <= '9') + option = option * 10 + *p++ - '0'; + if (*p == ';') + p++; + + switch (option) { + case 0: + case 2: + screen_set_title(ictx->ctx.s, p); + server_status_window(ictx->wp->window); + break; + case 12: + screen_set_cursor_colour(ictx->ctx.s, p); + break; + case 112: + if (*p == '\0') /* No arguments allowed. */ + screen_set_cursor_colour(ictx->ctx.s, ""); + break; + default: + log_debug("%s: unknown '%u'", __func__, option); + break; + } } /* APC string started. */ |