Re: SEGV in msg_may_trunc()
- Pawel S. Veselov wrote:
> this will work, but it will still count the length of the string twiceThe first time it's counted with strlen(), which is really fast. If it
> which I tried to avoid...
fits in the room when counting bytes, then it will also fit when
counting characters (there may be more bytes than characters, but not
the other way around). That avoids calling the slow vim_strsize() for
I do notice that the change I made does put in a ">" when the string
just fits. I'll change that.
> Still, what about the case when the '>' is placed into one of the bytesIt is placed in the last byte of a multibyte character and then the
> of a multibyte character ?
pointer is adjusted to start displaying the '>'. That will always work.
For example, if the message has "aaa123bbbb", where "123" is a multibyte
character, then it may become "aaa12>bbbb" and ">bbbb" is displayed.
"I've been teaching myself to play the piano for about 5 years and now write
most of my songs on it, mainly because I can never find any paper."
Jeff Lynne, ELO's greatest hits
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://www.ICCF.nl ///