correct the logic of automatically copying selection to clipboard