Christian Brabandt wrote:
> On Do, 28 Feb 2013, John Little wrote:
>
> > It happens for me (on Kubuntu 12.10, 7.3.843).
> > xclip -o reports
> >
> > Error: target STRING not available
> >
> > and other apps (I tried konsole, kate, firefox, LibreOffice) paste nothing.
>
> Interestingly, when using terminal vim, it returns some kind of utf
> representation of the original buffer for the clipboard. E.g. I put
> U+FF41 in the clipboard, call system('true') and :display + returns
> \uff41
>
> This patch fixes it for me:
> diff --git a/src/ui.c b/src/ui.c
> --- a/src/ui.c
> +++ b/src/ui.c
> @@ -2119,7 +2119,11 @@
> text_prop.encoding = *type;
> text_prop.format = *format;
> text_prop.nitems = len;
> - status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
> + if (*type == utf8_atom)
> + status = Xutf8TextPropertyToTextList(X_DISPLAY, &text_prop,
> + &text_list, &n_text);
> + else
> + status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
> &text_list, &n_text);
> if (status != Success || n_text < 1)
> {
>
>
> In the gui, it seems, I get always garbage, since the for some reason I
> think nothing is stored into the clipboard and therefore Vim tries to
> restore the info from the CUT_BUFFER0, which can only hold latin1
> encoded data and it breaks here. I tried uncommenting
> clip_mch_lose_selection() in gui_gtk_x11.c and this seems to work, but I
> am not really sure (could be, that this relies on some clipboard manager
> to work) this is right.
I included this patch, but it doesn't change anything for me.
After the system call the \uff41 character is always broken up in two
characters.
The problem is that x11_export_final_selection() only works for latin1.
Otherwise it just messes up the cut buffer.
We could avoid putting an invalid string in the cut buffer. Then when
there is a clipboard manager running it hopefully takes over the lost
selection text. I'll make a patch for this.
The only other solution I can think of is saving the owned selection and
restoring it after system() finishes. We would need to check that the
command executed by system() did not change the selection.
--
Time is an illusion. Lunchtime doubly so.
-- Ford Prefect, in Douglas Adams'
"The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" 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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.