astrand / xclip

Command line interface to the X11 clipboard
GNU General Public License v2.0
1.03k stars 73 forks source link

What is the use case for -loops? #105

Open hackerb9 opened 3 years ago

hackerb9 commented 3 years ago

What is the purpose of -loops? In trying to figure out how to fix -loops in bug #73, I'm coming to the conclusion that they will be complex and bring subtle errors in the future. Are they worth it?

Here is the comment I made in that bug report about what we can do to fix -loops for right now and questions we'll need to address in the future:


Certain programs send many more paste requests than they should. For example, middle-click pasting into this very message using Mozilla Firefox triggered 21 paste requests, the first sixteen of which are simply duplicate requests for TARGETS (the list of available targets). Since requests for special targets like TARGETS, TIMESTAMP, and MULTIPLE aren't genuine pastes, they should not increment dloops. This should be fairly easy for us to fix.

However, that still leaves five paste requests for that single middle click. The browser asks for five different targets: text/plain;charset=utf-8, UTF8_STRING, COMPOUND_TEXT, STRING, and text/x-moz-text-internal. Since xclip only holds one format, xclip should decline the other four of those requests and not increment dloops. (This is bug #94).

Once those two problems are solved, we should reevaluate whether the loops feature is still broken.

Originally posted by @hackerb9 in https://github.com/astrand/xclip/issues/73#issuecomment-722752868