From 111f4a8fe5cb6a9197fa79a693629757b31ab30d Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 3 Apr 2013 08:11:24 +0000 Subject: win32.c: pass through unknown sequence * win32/win32.c (constat_apply): pass through unknown sequence which starts with ESC but is not followed by a bracket. [ruby-core:53879] [Bug #8201] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index 3ce6949779..cdac41b456 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5787,9 +5787,19 @@ constat_parse(HANDLE h, struct constat *s, const WCHAR **ptrp, long *lenp) WCHAR wc = *ptr++; if (wc == 0x1b) { rest = *lenp - len - 1; + if (s->vt100.state == constat_esc) { + rest++; /* reuse this ESC */ + } + s->vt100.state = constat_init; + if (len > 0 && *ptr != L'[') continue; s->vt100.state = constat_esc; } - else if (s->vt100.state == constat_esc && wc == L'[') { + else if (s->vt100.state == constat_esc) { + if (wc != L'[') { + /* TODO: supply dropped ESC at beginning */ + s->vt100.state = constat_init; + continue; + } rest = *lenp - len - 1; if (rest > 0) --rest; s->vt100.state = constat_seq; -- cgit v1.2.3