xclip is a command line interface to the X clipboard. When I was trying to set up a security function with this tool, I observed some effects I don't understand.
What I did is I piping strings into xclip with the loops option set to 1 (xclip exits after a single paste event with loops set to 1), like this:
echo test | xclip -loops 1 -display :0 -selection c -verbose
Then, when I tried to paste on my Linux Mate desktop, I observed the following: Pasting into a web form or the Firefox search bar worked like a charm with loops set to 1, but pasting into the address bar of Firefox was not possible like this.
In order to paste to the Firefox address bar, it was necessary to increase loops to 2, i.e. two paste events were "consumed". Pasting into the address bar of Google Chrome consumed 4 paste events. Even pasting into a simple text editor like Pluma required 2 paste events.
But why is this? Why is it sometimes necessary to provide the clipboard content several times in order to successfully paste into an application, and why do applications behave so different?