Oh I forgot to ask: > > The biggest issue from my point of view, is in screen.c. In the current > implementation, we assume each character is either 1 byte or 2 bytes (CJK > multichar). On screen, a 1-byte character only occupies the space of one > column and a 2-byte character occupies the space of exactly two columns. > Thus, if the window width is 80, it allows exactly 80 bytes of data > regardless of how many actual characters there are. In this case, for > each line, we allocated 80 bytes for the actual characters, and 80 words > for the rendering characteristics, such as color, bold font, CJK property > (first byte or second byte of a CJK character). But this mechanism will > be broken for UTF8 because each UTF8 character may use a different number > of bytes (from one to six), and its width on screen is also different! > > My suggestion (again, immature) is to redesign text_t and rend_t. For > text_t, we should allow multiple bytes. For rend_t, we should store the > actual width of the character on screen. The second is easy: only one > bit is needed if we assumes each character uses up to 2 columns. But > the first needs a careful consideration: if we simply define text_t as > an array of 6 bytes, we may end up wasting a huge amount of memory! >
Why in the current implementation, 2 bytes character should occupy the space of 2 columns? I guess that is because you have many complicated characters (like the asian ones) in the 2 bytes (or more) character plans. And for these characters, you may need more place to display. But I think you can also have very small (or invisible even!) characters encoded with more than one byte. Or is it only some kind of approximative prediction, in order to get the big view before effectively displaying the strings (and then see their real size, potentially different from prediction)? ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ Materm-devel mailing list Materm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/materm-devel mrxvt home page: http://materm.sourceforge.net