From 2a03fbbd04eb3014167d2988ee4fd9d34f73d28a Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Thu, 4 Oct 2012 23:18:59 +0000 Subject: [PATCH] terminology: Add DCS handler SVN revision: 77485 --- src/bin/termptyesc.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index a7d8185a..7aa0c91a 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -980,6 +980,43 @@ _handle_esc_terminology(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) return cc - c; } +static int +_handle_esc_dcs(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) +{ + const Eina_Unicode *cc; + Eina_Unicode buf[4096], *b; + char *s; + int len = 0; + + cc = c; + b = buf; + while ((cc < ce) && (*cc != ST)) + { + if ((cc < ce - 1) && (*cc == ESC) && (*(cc + 1) == '\\')) + { + cc++; + break; + } + *b = *cc; + b++; + cc++; + } + *b = 0; + if ((*cc == ST) || (*cc == '\\')) cc++; + else return -2; + switch (buf[0]) + { + case '+': + /* TODO: Set request termcap/terminfo */ + break; + default: + // many others + ERR("unhandled dcs esc '%c'", buf[0]); + break; + } + return cc - c; +} + static int _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) { @@ -993,6 +1030,8 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce) return 2 + _handle_esc_xterm(ty, c + 2, ce); case '}': return 2 + _handle_esc_terminology(ty, c + 2, ce); + case 'P': + return 2 + _handle_esc_dcs(ty, c + 2, ce); case '=': // set alternate keypad mode ty->state.alt_kp = 1; return 2;