Friday, September 17, 2010

Re: More information about the strange clipboard behaviour

On Fri, 17 Sep 2010, Bram Moolenaar wrote:

>
> Raulnac wrote:
>
>> Saluton Bram :)
>>
>> I'm not going to trim my original message so the thread is easier to
>> follow from this point on, specially if someone google for help.
>>
>> Bram Moolenaar skribis:
>>>> 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.
>>>>

[...]

> Perhaps Chrome puts HTML in the selection?

Running Google Chrome 6.0.437.1 (Official Build 49781)
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Aug 22 2010 15:00:27)
Included patches: 1-442

Chrome does put HTML in the selection. But, not in the one that's
broken.

I found this Chromium bug-report related to a clipboard problem:
http://code.google.com/p/chromium/issues/detail?id=34813

The actual problem doesn't look relevant, but there's a useful
clipboard/selection examining tool in one of the comments:
http://code.google.com/p/chromium/issues/detail?id=34813#c9
Downloaded: gtk_clipboard_dump.cc
Compiled: g++ $(pkg-config --cflags --libs gtk+-2.0) -o ~/bin/gtk_clipboard_dump ~/Download/gtk_clipboard_dump.cc

Copying the David Gómez sample text in Chrome, and running
gtk_clipboard_dump yields:

Desktop clipboard
9 available targets:
---------------
[format: TIMESTAMP / length: 8 / bits 32]: (time omitted)
[format: TARGETS / length: 72 / bits 32]: u_______q_______t_______w______________x_______G_______y_______z_______
[format: MULTIPLE]: NULL
[format: COMPOUND_TEXT / length: 12 / bits 8]: David Gómez
[format: STRING / length: 12 / bits 8]: David Gómez
[format: TEXT / length: 12 / bits 8]: David Gómez
[format: UTF8_STRING / length: 12 / bits 8]: David Gómez
[format: text/html / length: 785 / bits 8]: <meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: collapse; color: rgb(80, 0, 80); font-family: arial, sans-serif; font-size: 13px; ">David Gómez</span></span>_
[format: text/plain / length: 12 / bits 8]: David Gómez

X clipboard
9 available targets:
---------------
[format: TIMESTAMP / length: 8 / bits 32]: (time omitted)
[format: TARGETS / length: 72 / bits 32]: u_______q_______t_______G_______w_______x______________|_______z_______
[format: MULTIPLE]: NULL
[format: UTF8_STRING / length: 12 / bits 8]: David Gómez
[format: COMPOUND_TEXT / length: 11 / bits 8]: David Gómez
[format: TEXT / length: 11 / bits 8]: David Gómez
[format: STRING / length: 11 / bits 8]: David Gómez
[format: text/plain;charset=utf-8 / length: 12 / bits 8]: David Gómez
[format: text/plain / length: 16 / bits 8]: David G\u00f3mez

--
Hope that's helpful,
Ben

--
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:

Post a Comment