improve PRIMARY buffer copy-paste behaviour, paste over

Johannes Thrän johannes.thraen at gmail.com
Sat Jun 20 18:49:03 UTC 2020


Hi,

On Tue, Mar 17, 2020 at 12:26 PM <elektra at markus-raab.org> wrote:

>
> A reference implementation sounds like a good next step
>

I found the time to change one of the gtk3 widgets (gtkentry) to behave
like I suggested earlier.
The widget supports paste-over-selection maneuvers using the mouse alone.
I didn't change any paradigma or workflow. I just specified a little
sharper, how primary selection
mark and paste via mouse should work.

Here's a video of it:
https://www.youtube.com/watch?v=iPROlvo3S0c

Here's how the widget in the video behaves; most of it is already specified
and/or practical canon:

 1. We have to distinguish 'visually selected text' and the (wayland-/X11-)
'primary selection'.
 The former is a widget's currently visible text selection,
 the latter is the text that a window receives, when it asks for the
current primary selection.
 The primary selection returns the last visually selected text, it persists
if text is unselected,
 it is updated if different text is selected.

 2. Update of the visual selection happens only on left mouse button press
or drag events.

 3. Update of the primary selection only happens on left mouse button
release events.
 (.. except for a little special rule for triple click below)

 4. Pasting the primary selection should happen on middle mouse press
events.

 4a. Middle mouse click on a visual text selection replaces the text
selection with the primary selection (like ctrl-v does).

 4b. .. middle mouse click somewhere else just pastes the text to the
cursor position nearest to the click

Special rules for double and triple clicks
 5: Double click on a word selects the word that was clicked on.
 Like specified above, the visual selection is updated on the second button
press;
 only when the button is released, the visual selection will be made
available as the primary selection.
 5a, Additionally, when the second click is released, the last primary
selection is memorized in a separate buffer for ..

 6. Triple click in a line selects the whole line. Rules above apply,
except that
 6a, The third registered mouse press restores the additionally memorized
buffer from 5a. to the primary selection.

 (with 5a and 6a, middle click pasteover also works in the context of
double and triple clicks without letting a timer run down)

I get that this seems very special to many.
Give it a try with a touchpad though. It really is convenient and useful.
Branch is here:
https://github.com/thraen/gtk/tree/gtk-3-22--thr--primary-buffer-pasteover
(branched off of a version of gtk3+ that can be built with ubuntu 18
without much hassle.)

Since I've seen some positive feedback from the list: I'd be happy to help
with implementations in this or that library.

At least, I'd suggest updating

https://specifications.freedesktop.org/clipboards-spec/clipboards-latest.txt
.

I think it should mention, that there is a way to do the middle click paste
thing 'right'.
May I ask, who would have the power of changing this document and whether
there is some willingness to change it?

VG, Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20200620/3d42f1e1/attachment.htm>


More information about the xdg mailing list