On Wed, Sep 06, 2006 at 02:15:36AM +0200, A.J.Mechelynck wrote:
> Benji Fisher wrote:
> >
> > Now that the problem has been pointed out, I think the patch should
> >be made in the official distribution. How about (simple but oh, so
> >clever)
> >
> > let plist = split(&matchpairs, '.\zs.')
> >
> >which removes every second character? Will that have trouble with
> >multibyte characters? Are these even allowed in 'matchpairs'?
>
> The help for 'matchparen' mentions only "single characters" which "must
> be different". You might try it with Arabic "ornate parentheses", U+FD3E
> (left i.e. closing) and U+FD3F (right i.e.opening), which are obviously
> meant to pair with each other.
I assume you mean the help for 'matchpairs', not 'matchparen'. I
tried
:let &mps = "\uFD3E:\uFD3F"
:set mps?
and the value was not changed. I think the docs should be changed to
mention that multi-byte characters are not allowed; as I read it,
"single characters" does not rule out multi-byte characters. I also do
not like the absence of an error message. I guess this is an issue with
:let & since I do get an E474 from
:set mps=<C-V>uFD3E:<C-V>uFD3F
(*not* typed literally).
> IIUC, a dot in a pattern matches one character, which may be one or more
> bytes, and which may occupy one screen cell, two for a wide CJK
> character, one to eight for a tab, etc.
Yes, and
:echo split("\uFD3E:\uFD3F", '.\zs.')
returns ['﴾', '﴿'] as expected. So I think my proposal for
matchparen.vim is safe even if 'matchpairs' is changed to allow
multi-byte characters.
HTH --Benji Fisher