From be04932d911751985a47608396858dff8b01f84d Mon Sep 17 00:00:00 2001 From: moculus Date: Mon, 16 Mar 2009 17:53:07 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- buffer/emul.py | 2 +- term.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/buffer/emul.py b/buffer/emul.py index 390334a..6b2f1d5 100644 --- a/buffer/emul.py +++ b/buffer/emul.py @@ -51,7 +51,7 @@ class XTermBuffer(Buffer, XTerm): XTerm.term_do_newline(self) #p = w.logical_cursor() #self.insert_string(p, "XYZ", act=ACT_NONE, force=True) - def term_do_style(self, s): + def term_do_style(self): pass def term_do_clear(self): self.set_lines([''], force=True) diff --git a/term.py b/term.py index c7aed07..479e8f8 100644 --- a/term.py +++ b/term.py @@ -127,8 +127,7 @@ class XTerm(Dumb): num_re = re.compile('^([a-zA-Z0-9]+)#(.+)$') str_re = re.compile('^([a-zA-Z0-9]+)=(.+)$') - style_re = re.compile(r'^\033\[[0-9;]+m') - #style_re = re.compile(r'^\033\[1m') + style_re = re.compile(r'^\033\[[0-9;]*m') text_signal_re = re.compile(r'^\033\][0-9]+;.+\007') cup_re = re.compile(r'^\033\[[0-9]+;[0-9]+H') @@ -184,7 +183,7 @@ class XTerm(Dumb): m = self.str_re.match(field) assert m, "huh?? %r" % field name, val = m.groups() - if val.startswith('\\E['): + if len(val) > 3 and val[:2] == '\\E[' and val[3] in '0123456789': continue elif val.startswith('\\E'): self.sequences[val.replace('\\E', '\033')] = name @@ -193,7 +192,10 @@ class XTerm(Dumb): def parse_style(self, s): # starts with '\033[' and ends with 'm' s2 = s[2:-1] - l = s2.split(';') + if s2 == '': + l = ['0'] + else: + l = s2.split(';') for n in l: if n == '0': self._fg = 'default'