Page MenuHomePhabricator

Terminology Copy&Paste using mouse-selection and middle-click does not work on Xorg (Xterm behavior)
Closed, InvalidPublic


Hi there!

I want to report a curious behavior with Terminology relating to copy&paste with the X clipboard.

The desired behavior is the one I'm experiencing with Xterm, which works:

  1. Selecting text in Xterm copies the selected text to any other application, i.e. Ctrl+V in firefox, geany or IntelliJ pastes the selected text.
  2. Copying text from firefox, geany or IntelliJ using Ctrl+C allows to paste the copied text using middle-mouse-click into Xterm

So far, so good. The actual behavior I'm experiencing with Terminology is the following

  1. Selecting text in Terminology copies the selected text to any other Terminology window, but nowhere else. When I Ctrl+V in firefox, geany or IntelliJ I only receive the previously selected text, but not the text I selected in Terminology. It works as expected, when I explicitly select "Copy" from the Terminology-context-menu, or Shift+Ctrl+C.
  2. Copying text from firefox, geany or IntelliJ using Ctrl+C does NOT allow to paste the copied text using middle-mouse-click into Terminology, except right after Terminology has been launched! It pastes any text I've previously selected with any Terminology window. It works when I explicitly select "Paste" from the right-click context menu in Terminology, or Shift+Ctrl+V.

I've tried to debug it by myself, but failed because the problem seems to be in the underlying efl code...but I'm not sure. I inserted fprintf() calls into the copy- and paste-related functions, and they do work as expected, please take a look at this screenshot, and watch out for the (1), (2), (3), (4) and (5) marked positions, which is the order of the actions I've taken (instead of a video):

  1. Copied text from IntelliJ using Ctrl+C
  2. Middle-click into terminology obviously works once!
  3. Copy text from Xterm by simply selecting it
  4. Middle-click into terminology pastes the text I previously copied in IntelliJ
  5. Shift+Ctrl+V finally pastes the text from Xterm!

The screenshot does also show an Xterm printing the fprintf() outputs, so the text is obviously the one being copied or pasted.
Can I provide any more useful information?

codepilot created this task.Dec 5 2018, 2:43 PM
ProhtMeyhet closed this task as Invalid.Dec 5 2018, 3:19 PM
ProhtMeyhet added a subscriber: ProhtMeyhet.

xterm uses a concept from X called cut buffers. i never understood it myself and there are many people who neither.


By default, xterm, and many other applications running under X, copy highlighted text into a buffer called the PRIMARY selection. The PRIMARY selection is short-lived; the text is immediately replaced by a new PRIMARY selection as soon as another piece of text is highlighted. Some applications will allow you to paste PRIMARY selections by using the middle-mouse, but not Shift+Insert, and some other applications may not allow pasting from PRIMARY entirely.
There is another buffer used for copied text called the CLIPBOARD selection. The text in the CLIPBOARD is long-lived, remaining available until a user actively overwrites it. Applications that use Ctrl+c and Ctrl+x for text copying and cutting operations, and Ctrl+v for pasting, are using the CLIPBOARD.
The fleeting nature of the PRIMARY selection, where copied text is lost as soon as another selection is highlighted, annoys some users. xterm allows the user to switch between the use of PRIMARY and CLIPBOARD using Select to Clipboard on the #VT Options menu or with the XTerm.vt100.selectToClipboard resource.


X11 uses two buffers: PRIMARY and CLIPBOARD. To copy/paste to the CLIPBOARD buffer you can often use CTRL-C and CTRL-V. You can insert to the PRIMARY buffer by selecting a text and paste from it by pressing the middle mouse button.
If you want to use the CLIPBOARD buffer, put this in your ~/.Xresources file and use Ctrl+Shift+C and Ctrl+Shift+V to copy/paste from/to the CLIPBOARD buffer in xterm: