From: Morgan Date: 2005-09-02T05:32:01+09:00 Subject: Re: Still looking for a Ruby MUD client Jacob Fugal wrote: >A solution, similar to that employed by ncurses and many other UI >systems, is to use the concept of an extended character. Each >character in the string is flagged with applicable attributes. >Translating marked up ASCII to a list of extended characters is easy >enough: maintain a bitmask of attributes and turn them on/off as you >encounter tags; apply the current bitmask to each character >encountered. Seems reasonable, but I do wonder how efficient the process would be. Something like that on each character makes me nervous. `.` >As an example application, your string would decode as follows: > >something = decode("A red and blue baseball bat.") ># => A, ' ', r|red, e|red, d|red, ' ', a, n, d, ' ', b|blue, l|blue, >u|blue, e|blue, ' ', b, a, s, ... > >The regex /red and blue/ would match this substring ># r|red, e|red, d|red, ' ', a, n, d, ' ', b|blue, l|blue, u|blue, e|blue > >That substring is replaced with the substring (since it wasn't encoded): ># o, s, t, r, i, c, h And then you'd get a bug report about how your replace is dropping color... At least, the behavior I would expect is to preserve the existing coloration. (Of course, then I specifically picked an example where there's no obvious sensible way to do that. Still, I think keeping the color would generally be expected.) -Morgan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.17/85 - Release Date: 08/30/2005