terminology: Add DCS handler

SVN revision: 77485
This commit is contained in:
Sebastian Dransfeld 2012-10-04 23:18:59 +00:00
parent 64d87067ba
commit 2a03fbbd04
1 changed files with 39 additions and 0 deletions

View File

@ -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;