Allowed lexer to use shorter hex codes for colors; shouldn't break compatibility

This commit is contained in:
karxi 2016-12-09 04:46:30 -05:00
parent dd0d306acb
commit daeaa74f61
2 changed files with 17 additions and 3 deletions

View file

@ -51,6 +51,7 @@ Features
* Add more comprehensive status support - IDLE, DND, INVISIBLE for now - or at least add similar functionality. * Add more comprehensive status support - IDLE, DND, INVISIBLE for now - or at least add similar functionality.
* SEPARATE FUNCTIONALITY from CONNECTED STATE!! This is a huge problem! Being shunted off our nick closes windows and breaks things! Just D/C and reconnect? * SEPARATE FUNCTIONALITY from CONNECTED STATE!! This is a huge problem! Being shunted off our nick closes windows and breaks things! Just D/C and reconnect?
* It'd probably be best to give an option to either CHANGE NICKS or DISCONNECT upon nick collision...? But, then how would we GHOST? * It'd probably be best to give an option to either CHANGE NICKS or DISCONNECT upon nick collision...? But, then how would we GHOST?
* Auto-disconnect if collsion before joining channels, make it possible to disconnect (but not send messages, obviously) without losing everything
* Maybe GHOSTing should use auto-identify to ensure- no, that doesn't work, because we can't ident into a specified nick without being ON it. Need GD's help to fix.... * Maybe GHOSTing should use auto-identify to ensure- no, that doesn't work, because we can't ident into a specified nick without being ON it. Need GD's help to fix....
* Separate Pesterchum system handling from window handling. Dicts should be stored and maintained via dicts - even a refined version of what I used for textsub. * Separate Pesterchum system handling from window handling. Dicts should be stored and maintained via dicts - even a refined version of what I used for textsub.
@ -71,6 +72,7 @@ Todo/Done
* Make sound work on Windows through QSound (disables volume control) * Make sound work on Windows through QSound (disables volume control)
* Toggle individual tab flash / alert sounds (from the same right-click memo that lets us toggle OOC) * Toggle individual tab flash / alert sounds (from the same right-click memo that lets us toggle OOC)
* Make CTRL+PGUP/PGDN switch memo/pester tabs * Make CTRL+PGUP/PGDN switch memo/pester tabs
* Color tags are now posted as their shorter hexadecimal forms, if applicable (255,255,255 -> #FFFFFF, for example)
Debugging Debugging
---- ----

View file

@ -121,10 +121,22 @@ class CTag(Specifier):
else: else:
if color.name: if color.name:
text = "<c=%s>" % color.name text = "<c=%s>" % color.name
elif self.compact:
text = "<c=%s>" % color.reduce_hexstr(color.hexstr)
else: else:
text = "<c=%d,%d,%d>" % color.to_rgb_tuple() # We should have a toggle here, just in case this isn't
# acceptable for some reason, but it usually will be.
rgb = "<c=%d,%d,%d>" % color.to_rgb_tuple()
hxs = color.hexstr
if self.compact:
# Try to crush it down even further.
hxs = color.reduce_hexstr(hxs)
hxs = "<c=%s>" % hxs
if len(rgb) <= len(hxs):
# Prefer the more widely-recognized default format
text = rgb
else:
# Hex is shorter, and recognized by everything thus
# far; use it.
text = hxs
elif format == "plaintext": elif format == "plaintext":
text = '' text = ''
return text return text