On Sat, Mar 25, 2000 at 07:54:01PM +0100, Bram Moolenaar wrote:
> Well, when using long lines this can be important anyway. And it's easy to
> make it like this:
> if (type)
> /* backup to before the character (possibly double-byte) */
> col -= dir;
> #ifdef MULTI_BYTE
> if (is_dbcs
> && ((dir < 0 && char_bytes == 2)
> ||(dir > 0 && IsTrailByte(p, &p[col]))))
> col -= dir;
> Again, please check that this works correctly.
It seems work correctly.
> > For the performance, mb_byte1(), mb_byte2(), and IsTrailByte() should be
> > avoided. In my patch submitted yesterday(screen.c patch for screen_line()),
> > I can remove mb_isbyte1() call. I'll post the patch if the submitted one
> > does not have any problem. (My new patch would be just a performance tuning.)
> Performance for screen_line() is very important. It's used for all display
If performance is most important, how about to make IsLeadByte as a MACRO
function? In WIN32 or BROKEN_LOCALE, It could be substituted as a MACRO.
And IsLeadByte is called most frequently in the MULTI_BYTE environment.
PS: Is there a safe and efficient way to guess IsLeadByte
without calling mblen()?
"I am a HAL 9000 computer, Production Number 3. I became operational
at the HAL Plant in Urbana, Illinois on January 12, 1997."
- spoken by HAL in the book 2001: A Space Odyssey, Arthur C. Clarke