implement insert by middle mouse button

I insert text by middle mouse button very often, this patch implement this functionality. But I am not sure that I've made it in a right way, is any case I can improve it.