Tuesday, September 14, 2010

Re: More information about the strange clipboard behaviour

Raul wrote:

> Hi all :)
>
> A time ago I posted a message about a problem I was having with the
> clipboard and Vim 7.2. After updating to 7.3 I checked to see if the
> problem had vanished.
> I'm using console-only Vim 7.3-3, self compiled, under Ubuntu Linux
> 10.04 with X Window System.
>
> Here is how I reproduce it:
> - I selected and copied the text "David Gómez" from a GMail message
> shown in Google Chrome. The problem only happens with that
> combination, Google Chrome and Vim.
> - From a terminal:
> $ xclip -selection primary -o | od -Ax -tx1
> 000000 44 61 76 69 64 20 47 c3 b3 6d 65 7a
> 00000c
> $ xclip -selection clipboard -o | od -Ax -tx1
> 000000 44 61 76 69 64 20 47 c3 b3 6d 65 7a
> 00000c
>
> As you can see, both the primary and the clipboard selections have the
> same text, the UTF-8 representation of "David Gómez".
>
> Now, I paste the text into an empty "vim -u NONE", using "+po<ESC>"*p
> and the screen shows this:
> David Gómez
> David Gómez
> ~
> ~
> ...
>
> As you can see the first text is pasted incorrectly, the second,
> correctly. Here is the output of ":registers"
>
> --- Registers ---
> "* David Gómez
> "+ David Gómez
>
> Again, it is shown that the "+" register is coded incorrectly.
>
> After this, I tried to paste the default clipboard (that is, the one
> that gets pasted usually with Ctrl-V) in many different applications
> without any problem.
> As shown by "xclip", both selections have exactly the same text, the
> same bytes, but Vim is treating them differently.
>
> Probably the problem is a Google Chrome one, but since only Vim shows
> this behaviour I don't know what to think. If somebody could give me
> another example of this problem (or reproduce it) I would be happy to
> report the problem to the Google people.

The text that xclip shows is only one of the possible contents. X11
uses atoms to select different types of text. Vim uses five different
ones, see src/ui.c, clip_x11_request_selection(). However, the cut
buffer only supports latin1. Perhaps Chrome puts multi-byte text in the
cut buffer?

--
hundred-and-one symptoms of being an internet addict:
136. You decide to stay in a low-paying job teaching just for the
free Internet access.

/// Bram Moolenaar -- Bram@Moolenaar.net -- 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://ICCF-Holland.org ///

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: