From: "Tseran" <Tseran@SEXMAGNET.COM> > Now, as I see it, we have 2 choices: process color BEFORE it hits > process_output, but that may take several lines of calling, since there > are more than one way to add text to the buffer. Or. We can try to > chance process_output a little bit so that it can handle these > situations. Hell no. You've got it backwards, sonny. ;) All you really need to do is have proc_color or whatever it's called, return a size_t and call it from inside vwrite_to_output like so: vsnprintf(txt, sizeof(txt), format, args); wantsize = size = process_color(txt, use_color, color_level); if (size < 0 || wantsize >= sizeof(txt)) size = sizeof(txt) - 1; Problem solved. I renamed my proc_colour() or whatever to process_color(). I added a variable to my vwrite_to_output to be able to return color codes unparsed, like so: size_t vwrite_to_output(struct descriptor_data *t, bool use_color, const char *format, va_list args) That way I can have the editor not parse colors, and so forth and so on, that's why the call to process_color takes one more argument in my version. Regards, /Torgny -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT