paste in CJK enviroment

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

paste in CJK enviroment

strange-2
hi vimmers!

I'am use gvim in a Chinese Windows. When I paste some CJK charactors
into vim, the cursor will stop before the last charactor instead of in
the end of these charactors.
eg:
if I paste "hello", it'll be "hello|".
but when paste "???", it'll be "??|??".

I used to think it's a bug of vim, anyone has clues?

Thank you in advance.

Strange
Reply | Threaded
Open this post in threaded view
|

Re: paste in CJK enviroment

A.J.Mechelynck
Strange wrote:

> hi vimmers!
>
> I'am use gvim in a Chinese Windows. When I paste some CJK charactors
> into vim, the cursor will stop before the last charactor instead of in
> the end of these charactors.
> eg:
> if I paste "hello", it'll be "hello|".
> but when paste "???", it'll be "??|??".
>
> I used to think it's a bug of vim, anyone has clues?
>
> Thank you in advance.
>
> Strange


Which version are you using? Which patchlevel (if any) or which snapshot
(or release date) if 7.0aa? The info can be had from the first three
lines of the reply to the ":version" command.

(I think I've seen a comment recently about a fix for string-length
errors with multibyte characters. I don't remember the subject of the
thread.)

If you paste a string with some Chinese characters in it, but ending in
something in 8-bit (e.g., Latin text, digits, things like that), does
the cursor end up where it should?


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: paste in CJK enviroment

adah
In reply to this post by strange-2
>> I'll make a patch.
>>
> Thanks! :-)

Before the patch is out, I am using:

if has('win32') || has('win64')
  source $VIMRUNTIME/mswin.vim
  imap <C-V> <C-R>+|      " Work around a bug regarding MBCS characters
endif

Best regards,

Yongwei
Reply | Threaded
Open this post in threaded view
|

Re: paste in CJK enviroment

Mathias Michaelis
In reply to this post by strange-2
Hi Bram

> I'll make a patch.
>
Thanks! :-)
Mathias
Reply | Threaded
Open this post in threaded view
|

Re: paste in CJK enviroment

strange-2
In reply to this post by strange-2
Bram Moolenaar wrote:
>
> I'll make a patch.
>
Thank you!

Is 6.4b.002 the patch for this problem? I compiled it and it seems
nothing have been changed. I've tried the binary from Tony's site too,
it's also have this problem.


Strange
Reply | Threaded
Open this post in threaded view
|

Re: paste in CJK enviroment

Bram Moolenaar

Strange -

> > I'll make a patch.
>
> Thank you!
>
> Is 6.4b.002 the patch for this problem? I compiled it and it seems
> nothing have been changed. I've tried the binary from Tony's site too,
> it's also have this problem.

Yes, 6.4b.002 should fix the problem.  It does for me.

Is your Vim compiled with 'virtualedit' support?  If not then perhaps
there is another problem.  Please describe exactly what you do and give
the example text.

- Bram

--
Bypasses are devices that allow some people to dash from point A to
point B very fast while other people dash from point B to point A very
fast.  People living at point C, being a point directly in between, are
often given to wonder what's so great about point A that so many people
from point B are so keen to get there and what's so great about point B
that so many people from point A are so keen to get there.  They often
wish that people would just once and for all work out where the hell
they wanted to be.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///
Reply | Threaded
Open this post in threaded view
|

Re: paste in CJK enviroment

Mathias Michaelis
In reply to this post by strange-2
Strange

> Is 6.4b.002 the patch for this problem? I compiled it and it seems
> nothing have been changed. I've tried the binary from Tony's site too,
> it's also have this problem.
>
Tony's version solved the problem on my computer (WinXP SP 2).

Best regards

Mathias
Reply | Threaded
Open this post in threaded view
|

Re: paste in CJK enviroment

Bram Moolenaar
In reply to this post by strange-2

Strange wrote:

> Yes, I has this option on. But the problem really exists. I'm using a
> Chinese version of Windows 2000 sp4. The vim version is 6.4b.2 BETA.
>
> I do these following:
> 1) upgrade vim6.4a to vim6.4b2. I simply copy the gvim.exe from tony's
> site to the vim6.4a directory and rename the directory from "vim64a" to
> "vim64b".
>
> 2) I open gvim with: gvim -u NONE
>
> 3) Within gvim, I type:
>     :set encoding=cp936
>     :source $VIMRUNTIME/mswin.vim
>
> 4) I copy ?? into the clipboard.
>
> 5) Within vims insert mode, I press Ctrl-V to insert these two
>     letters.
>
> It seems that when the encoding=utf-8 is set, everything is ok, but when
> the encoding is set to cp936, this problem also exists.
> Is this helpful to the problem?

Aha, 'encoding' set to cp936 was the relevant setting.  Now I can
reproduce the problem.

I made a new patch.  I now see that patch 6.4b.002 was only working
around the real problem.

Please test version 6.4b.003.  Not only for this specific problem, the
patch changes some code that is used in many places.  But only when
'virtualedit' is set.

--
How To Keep A Healthy Level Of Insanity:
8. Don't use any punctuation marks.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///