diff -r 8428d15cbeff Lib/idlelib/pyshell.py --- a/Lib/idlelib/pyshell.py Sat Jun 04 07:13:38 2016 +0000 +++ b/Lib/idlelib/pyshell.py Sat Jun 04 14:15:39 2016 +0300 @@ -1548,6 +1548,15 @@ def main(): flist = PyShellFileList(root) macosx.setupApp(root, flist) + if root._windowingsystem == 'x11': + # Pasting from the clipboard doesn't delete the current selection + # on X11. + # See issue #5124. + for cls in 'Text', 'Entry', 'Spinbox': + root.bind_class(cls, '<>', + 'catch {%W delete sel.first sel.last}\n' + + root.bind_class(cls, '<>')) + if macosx.isAquaTk(): # There are some screwed up <2> class bindings for text # widgets defined in Tk which we need to do away with.