Changed xterm256 formatting to work with Potato. Also added Potato as a TTYPE exception since the client doesn't report itself correctly.

This commit is contained in:
Griatch 2016-08-28 16:36:44 +02:00
parent 9ec875f29c
commit 668029e82e
2 changed files with 6 additions and 2 deletions

View file

@ -116,7 +116,8 @@ class Ttype(object):
"MUDLET", # > beta 15 (sep 2009)
"MUSHCLIENT", # > 4.02 (apr 2007)
"PUTTY", # > 0.58 (apr 2005)
"BEIP")) # > 2.00.206 (late 2009) (BeipMu)
"BEIP", # > 2.00.206 (late 2009) (BeipMu)
"POTATO")) # > 2.00 (maybe earlier)
# all clients supporting TTYPE at all seem to support ANSI
self.protocol.protocol_flags['ANSI'] = True

View file

@ -137,7 +137,10 @@ class ANSIParser(object):
if use_xterm256:
colval = 16 + (red * 36) + (green * 6) + blue
return "\033[%s8;5;%s%s%sm" % (3 + int(background), colval // 100, (colval % 100) // 10, colval%10)
return "\033[%s8;5;%sm" % (3 + int(background), colval)
# replaced since some cliens (like Potato) does not accept codes with leading zeroes, see issue #1024.
#return "\033[%s8;5;%s%s%sm" % (3 + int(background), colval // 100, (colval % 100) // 10, colval%10)
else:
# xterm256 not supported, convert the rgb value to ansi instead
if red == green == blue and red < 3: