Author terry.reedy
Recipients Guilherme.Simões, Mark.Young, Todd.Rovito, gpolo, ned.deily, r.david.murray, roger.serwy, serhiy.storchaka, terry.reedy, weeble
Date 2016-06-03.18:57:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464980235.16.0.345718154921.issue5124@psf.upfronthosting.co.za>
In-reply-to
Content
Thank you David, that does help.  Your comment emphasizes that on other systems and many other X-11 apps, the user already chooses 'replace' versus 'insert' by selecting a replacement or not.   I presume the 'selection buffer' you refer to is different from the 'clipboard' (or whatever linux calls it).  Otherwise, Roger's patch would not work and I assume he tested it.

Simply applying Roger's patch, in 3.6, would be **MUCH** easier than adding a new option.  I could even add a line to the sign-on message: "Paste now replaces selected text.  Use undo to correct mistakes."

Assuming the patch does work, here is a workaround for releases that lack it. Create in Lib/idlelib a file called, for instance @MYPATCHES.txt and insert with the following, to remind what to do after upgrading to a new bugfix release.
---
To make paste replace selection, insert the following 3 lines at the top (after the def line) of EditorWindow.paste, about line 600, in file EditorWindow.py (3.5 and before) or editor.py (3.6 and after).

        sel = self.text.tag_ranges("sel")
        if sel:
            self.text.delete(*sel)   # issue5124
---

Save and then follow the instruction to patch the editor file. If doing the edit in IDLE, hit F5 to test the patched EditorWindow.
History
Date User Action Args
2016-06-03 18:57:15terry.reedysetrecipients: + terry.reedy, gpolo, ned.deily, roger.serwy, weeble, r.david.murray, Todd.Rovito, Mark.Young, serhiy.storchaka, Guilherme.Simões
2016-06-03 18:57:15terry.reedysetmessageid: <1464980235.16.0.345718154921.issue5124@psf.upfronthosting.co.za>
2016-06-03 18:57:15terry.reedylinkissue5124 messages
2016-06-03 18:57:14terry.reedycreate