[Python-checkins] bpo-39885: IDLE context menu clears selection (GH-18859)

Miss Islington (bot) webhook-mailer at python.org
Sun Mar 8 15:47:09 EDT 2020


https://github.com/python/cpython/commit/b2e8240261aa879b8978d7add6dd1efc4318add1
commit: b2e8240261aa879b8978d7add6dd1efc4318add1
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-03-08T12:47:05-07:00
summary:

bpo-39885: IDLE context menu clears selection  (GH-18859)


Since clicking to get an IDLE context menu moves the cursor,
any text selection should be and now is cleared.
(cherry picked from commit 4ca060d8ad7c6df1fd4df30f9a14f6aa35380c09)

Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>

files:
A Misc/NEWS.d/next/IDLE/2020-03-08-14-27-36.bpo-39885.29ERiR.rst
M Lib/idlelib/NEWS.txt
M Lib/idlelib/editor.py

diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 8493192be9a57..83930f77c7c03 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,6 +3,9 @@ Released on 2019-12-16?
 ======================================
 
 
+bpo-39885: Since clicking to get an IDLE context menu moves the
+cursor, any text selection should be and now is cleared.
+
 bpo-39852: Edit "Go to line" now clears any selection, preventing
 accidental deletion.  It also updates Ln and Col on the status bar.
 
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index 5b81b52f9196c..51941900d5c74 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -499,6 +499,7 @@ def handle_yview(self, event, *args):
     rmenu = None
 
     def right_menu_event(self, event):
+        self.text.tag_remove("sel", "1.0", "end")
         self.text.mark_set("insert", "@%d,%d" % (event.x, event.y))
         if not self.rmenu:
             self.make_rmenu()
diff --git a/Misc/NEWS.d/next/IDLE/2020-03-08-14-27-36.bpo-39885.29ERiR.rst b/Misc/NEWS.d/next/IDLE/2020-03-08-14-27-36.bpo-39885.29ERiR.rst
new file mode 100644
index 0000000000000..f0f434ad3c1f4
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2020-03-08-14-27-36.bpo-39885.29ERiR.rst
@@ -0,0 +1,2 @@
+Since clicking to get an IDLE context menu moves the cursor,
+any text selection should be and now is cleared.



More information about the Python-checkins mailing list