You are not logged in.

#1 2011-07-02 14:57:46

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

[SOLVED] Rxvt-unicode fails to paste PRIMARY selection owned by Vim

Urxvt almost always work with the X PRIMARY selection. i.e., if I select some
text in Firefox or other applications, I will be able to paste it in urxvt.

But Vim seems to be an exception. Steps to reproduce:

  1. Select some text ("foo") in Vim, either using the mouse or in visual mode.
     Leave the Vim window open.

  2. In another urxvt window, press Shift-Insert, _nothing_ is pasted.
     Middle mouse click has the same effect as Shift-Insert in urxvt.

  3. Issue the command `xsel -po`, and the text "foo" is printed. This means
     the text is indeed what the X PRIMARY selection holds (or points to).

  4. The text "foo" is also pasted in Firefox by middle mouse click.
     The text "foo" is also pasted in xterm by either middle mouse click or
     Shift-Insert.

  5.1. If you do `xsel -po | xsel -pi`, urxvt will behave like everyone else.

  5.2. Without doing 5.1, quit Vim (:q). After that, "foo" will be pasted in
       urxvt by Shift-Insert.
       What Vim does on quit is documented in its help (:h x11-cut-buffer):
       

Vim wrote:

There are, by default, 8 cut-buffers: CUT_BUFFER0 to CUT_BUFFER7.  Vim only
uses CUT_BUFFER0, which is the one that xterm uses by default.

Whenever Vim is about to become unavailable (either via exiting or becoming
suspended), and thus unable to respond to another application's selection
request, it writes the contents of any owned selection to CUT_BUFFER0.  If the
"+ CLIPBOARD selection is owned by Vim, then this is written in preference,
otherwise if the "* PRIMARY selection is owned by Vim, then that is written.

My guesses are:

  * Urxvt somehow requires the cut buffer (CUT_BUFFER0) to sync with the
    PRIMARY selection, otherwise it will fail to request the PRIMARY selection.

  * The reason why text selected from applications other than Vim can be pasted
    just fine in urxvt is probably that they always sync the cut buffer with the
    PRIMARY selection.

I may be wrong, so please do comment.

If my conclusion proves to be right, I will file a bug report to rxvt-unicode.

Edit: This issue is fixed in rxvt-unicode 9.12.

Last edited by lolilolicon (2011-07-02 16:31:45)


This silver ladybug at line 28...

Offline

#2 2011-07-02 15:36:59

listdata
Member
Registered: 2008-12-23
Posts: 102
Website

Re: [SOLVED] Rxvt-unicode fails to paste PRIMARY selection owned by Vim

lolilolicon wrote:

Urxvt almost always work with the X PRIMARY selection. i.e., if I select some
text in Firefox or other applications, I will be able to paste it in urxvt.

But Vim seems to be an exception. Steps to reproduce:

  1. Select some text ("foo") in Vim, either using the mouse or in visual mode.
     Leave the Vim window open.

  2. In another urxvt window, press Shift-Insert, _nothing_ is pasted.
     Middle mouse click has the same effect as Shift-Insert in urxvt.

  3. Issue the command `xsel -po`, and the text "foo" is printed. This means
     the text is indeed what the X PRIMARY selection holds (or points to).

  4. The text "foo" is also pasted in Firefox by middle mouse click.
     The text "foo" is also pasted in xterm by either middle mouse click or
     Shift-Insert.

  5.1. If you do `xsel -po | xsel -pi`, urxvt will behave like everyone else.

  5.2. Without doing 5.1, quit Vim (:q). After that, "foo" will be pasted in
       urxvt by Shift-Insert.
       What Vim does on quit is documented in its help (:h x11-cut-buffer):
       

Vim wrote:

There are, by default, 8 cut-buffers: CUT_BUFFER0 to CUT_BUFFER7.  Vim only
uses CUT_BUFFER0, which is the one that xterm uses by default.

Whenever Vim is about to become unavailable (either via exiting or becoming
suspended), and thus unable to respond to another application's selection
request, it writes the contents of any owned selection to CUT_BUFFER0.  If the
"+ CLIPBOARD selection is owned by Vim, then this is written in preference,
otherwise if the "* PRIMARY selection is owned by Vim, then that is written.

My guesses are:

  * Urxvt somehow requires the cut buffer (CUT_BUFFER0) to sync with the
    PRIMARY selection, otherwise it will fail to request the PRIMARY selection.

  * The reason why text selected from applications other than Vim can be pasted
    just fine in urxvt is probably that they always sync the cut buffer with the
    PRIMARY selection.

I may be wrong, so please do comment.

If my conclusion proves to be right, I will file a bug report to rxvt-unicode.

Hi lolilolicon,

I cannot reproduce the errors from step 2. My system has the following packages:

gvim 7.3.206-1
vim-runtime 7.3.206-1
rxvt-unicode 9.12-1

To be fair, rxvt-unicode was upgraded to 9.12 recently (I think it was sometime last week), and I also recall vim's visual mode selections NOT being paste-able into a separate urxvt window. But I guess the 9.12 update fixed things. (There are a couple regression fixes with the words "selection" to describe them @ http://cvs.schmorp.de/rxvt-unicode/Changes .) I tested both gvim and regular console vim (visual mode) and it all worked. I also double-checked with `xsel -po`.

Offline

#3 2011-07-02 15:39:13

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Rxvt-unicode fails to paste PRIMARY selection owned by Vim

It works for me.

lolilolicon, you wouldn't happen to be using urxvt-clipboard?

Offline

#4 2011-07-02 15:53:34

xamaco
Member
From: Corsica, France
Registered: 2010-04-05
Posts: 87

Re: [SOLVED] Rxvt-unicode fails to paste PRIMARY selection owned by Vim

I you use vim only and not gvim, by default in arch (and many other distros), vim is compiled without support for xclipboard.
I do use vim only. To enable xclipboard in vim, I have to compile it. For that, I use abs. I then modify the PKBUILD file and replace in the vim-build section '--with-x=no' by '--with-x=yes'.

Hope it helps...

Offline

#5 2011-07-02 15:59:29

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Rxvt-unicode fails to paste PRIMARY selection owned by Vim

xamaco wrote:

I you use vim only and not gvim, by default in arch (and many other distros), vim is compiled without support for xclipboard.
I do use vim only. To enable xclipboard in vim, I have to compile it. For that, I use abs. I then modify the PKBUILD file and replace in the vim-build section '--with-x=no' by '--with-x=yes'.

Hope it helps...

I've been using my own copy of vim without recompiling it for so long that I totally forgot about that.

Offline

#6 2011-07-02 16:08:43

drrossum
Member
From: Chicago
Registered: 2009-02-24
Posts: 82

Re: [SOLVED] Rxvt-unicode fails to paste PRIMARY selection owned by Vim

I cannot reproduce the errors from step 2. My system has the following packages:

gvim 7.3.206-1
vim-runtime 7.3.206-1
rxvt-unicode 9.12-1

To be fair, rxvt-unicode was upgraded to 9.12 recently (I think it was sometime last week), and I also recall vim's visual mode selections NOT being paste-able into a separate urxvt window. But I guess the 9.12 update fixed things. (There are a couple regression fixes with the words "selection" to describe them @ http://cvs.schmorp.de/rxvt-unicode/Changes .) I tested both gvim and regular console vim (visual mode) and it all worked. I also double-checked with `xsel -po`.

Indeed, also for me these latest changes solved the 'fails to paste' problem.

But... I find the new urxvt version very slow (when scrolling text up/down). I need to do some more testing though.

Daan

Offline

#7 2011-07-02 16:09:02

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: [SOLVED] Rxvt-unicode fails to paste PRIMARY selection owned by Vim

@skottish, no I'm not using urxvt-clipboard.

@listdata Ah, I haven't updated for several days. All fine now after upgrading from 9.11 to 9.12, thanks very much!

<on_fire>Man why why why you play me like this‽ Fix a bug right before I knock knock knock on your door?</on_fire>


This silver ladybug at line 28...

Offline

Board footer

Powered by FluxBB