]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39885: IDLE context menu clears selection (GH-18859)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 8 Mar 2020 19:47:05 +0000 (12:47 -0700)
committerGitHub <noreply@github.com>
Sun, 8 Mar 2020 19:47:05 +0000 (12:47 -0700)
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@udel.edu>
Lib/idlelib/NEWS.txt
Lib/idlelib/editor.py
Misc/NEWS.d/next/IDLE/2020-03-08-14-27-36.bpo-39885.29ERiR.rst [new file with mode: 0644]

index 8493192be9a57fc23888defe2f555e7804084129..83930f77c7c030be7331602dde44fb96e257e6bb 100644 (file)
@@ -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.
 
index 5b81b52f9196c490ad66d795614cd92a4ff06468..51941900d5c741466874f6a30f4f775378f7a78d 100644 (file)
@@ -499,6 +499,7 @@ class EditorWindow(object):
     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 (file)
index 0000000..f0f434a
--- /dev/null
@@ -0,0 +1,2 @@
+Since clicking to get an IDLE context menu moves the cursor,
+any text selection should be and now is cleared.