Re: [Vim-latex-cvs] vimfiles/plugin imaps.vim,1.14,1.15
Brought to you by:
srinathava,
tmaas
|
From: Srinath A. <sr...@fa...> - 2002-12-31 07:28:21
|
On Mon, 30 Dec 2002, Benji Fisher wrote:
> Maybe we should go back to the idea of positioning the cursor with
> {count}<bs> and {count}<space> (in Normal mode). The comment in the
> code says that the problem is that strlen() returns different values
> depending on the encoding. Does anyone remember how to produce an
> example of this? Did we ever try
>
> :let n =3D strlen(substitute(text, ".", "x", "g"))
>
Yes. Positioning using movement is the best... The problem I ran across
was that if you do something like
:set encoding=3Dutf8
:let bar =3D "=AB"
=09(where the =AB character is typed using <C-v><<)
:echo strlen(bar)
2
Can this problem be taken care of using the change in encoding etc?
Hmm... I see that
:echo strlen(iconv(bar, &encoding, 'latin1'))
1
:echo strlen(substitute(bar, '.', 'x', 'g'))
1
So those two methods might work... It will be a definite improvement
over the current "hack".
On a different note:
imaps.vim now contains:
=09let textEnc =3D iconv(text, "latin1", &enc)
=09[snip]
=09" If there are no place holders, just return the text.
=09if textEnc !~ '\V'.phs.'\.\{-}'.phe
=09=09return text
=09endif
Shouldn't the comparision be:
=09" If there are no place holders, just return the text.
=09if textEnc !~ '\V'.phsEnc.'\.\{-}'.pheEnc
=09=09return text
=09endif
Maybe this is why Fabio is having that problem?
I am wary of making any changes here because I haven't thought about
this as much as you have...
Srinath
|