◐ Shell
clean mode source ↗

Issue 39885: IDLE right click outside of any selection should clear it

Created on 2020-03-07 05:08 by terry.reedy, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (12) msg363577 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-03-07 05:08
In text editors, right click commonly brings up a context menu, often including Cut, Copy, Paste, and Delete, with inapplicable entries grayed out.  There are at least 2 'standard' behaviors (at least on Windows) with respect to the cursor and selections. 

0 (Examples: Windows Notepad and Firefox entry box).  The cursor stays where it is and a selection stays selected, even if one has scrolled the cursor and possible selection off the screen with mousewheel or scrollbar. Paste inserts at the possibly hidden cursor, deleting any possibly hidden selection.  The view jumps back to the cursor after Paste but not after Copy and Close (Esc).

1 (Examples: Windows Notepad++ and Libre Office).  The cursor jumps to the spot of the click, the same as with a left click.  Any selection, possibly not visible, is unselected, the same as with a left click.  Exception: a right click within an exception leaves the selection and cursor (at one of the ends) alone.

IDLE follows a bit of each pattern and neither.  Right click always moves the cursor, even within a selection, but never clears a selection.  I believe that this is an accident of history.  Originally, context menus only had 'Go to file/line' in Shell and grep output and 'Set/Clear Breakpoint' in editors.  There was no reason to touch a selection even if the cursor was moved.  Cut/Copy/Paste were added in 2012 because they are standard.

To really be standard, right click should consistently act like left click and unselect.  This prevents accidental deletion.  This would also be consistent with making 'Go to line' act the same.

Also, right click within a selection should not move the cursor.
msg363578 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-03-07 05:11
Spinoff from #39852.  At least the selection clear code added there should be pulled into a module level function and tested.
msg363580 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-03-07 05:17
(Mozilla) Thunderbird, unlike (Mozilla) Firefox, has move/clear right clicks.
msg363581 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-03-07 05:29
I believe the following is true: when only one selection is allowed, the cursor is normally at one end or the other, and any cursor movement either clear the selection or changes its range.
msg363675 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-03-08 19:30
New changeset 4ca060d8ad7c6df1fd4df30f9a14f6aa35380c09 by Terry Jan Reedy in branch 'master':
 bpo-39885: IDLE context menu clears selection  (#18859)
https://github.com/python/cpython/commit/4ca060d8ad7c6df1fd4df30f9a14f6aa35380c09
msg363676 - (view) Author: miss-islington (miss-islington) Date: 2020-03-08 19:46
New changeset f9684d222effff0950c1ce206873a9c66dfd30ed by Miss Islington (bot) in branch '3.7':
bpo-39885: IDLE context menu clears selection  (GH-18859)
https://github.com/python/cpython/commit/f9684d222effff0950c1ce206873a9c66dfd30ed
msg363677 - (view) Author: miss-islington (miss-islington) Date: 2020-03-08 19:47
New changeset b2e8240261aa879b8978d7add6dd1efc4318add1 by Miss Islington (bot) in branch '3.8':
bpo-39885: IDLE context menu clears selection  (GH-18859)
https://github.com/python/cpython/commit/b2e8240261aa879b8978d7add6dd1efc4318add1
msg363991 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-03-12 03:14
Restore not clearing the selection when click within it. See Exception in 1 above.  Users need to continue to see what will be copied or cut (which also happens with paste).

The breakpoint toggle and goto file/line options on the context menu need the line number of the click.  If the cursor is not moved, another alternative is needed.
msg370337 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-29 22:54
New changeset 97e4e0f53d6690db6b942678489716a30925b8af by Terry Jan Reedy in branch 'master':
bpo-39885: Make IDLE context menu cut and copy work again (GH-18951)
https://github.com/python/cpython/commit/97e4e0f53d6690db6b942678489716a30925b8af
msg370339 - (view) Author: miss-islington (miss-islington) Date: 2020-05-29 23:11
New changeset 80b6a05d38ce34ef543a2376b8132eef4ada67ce by Miss Islington (bot) in branch '3.7':
bpo-39885: Make IDLE context menu cut and copy work again (GH-18951)
https://github.com/python/cpython/commit/80b6a05d38ce34ef543a2376b8132eef4ada67ce
msg370340 - (view) Author: miss-islington (miss-islington) Date: 2020-05-29 23:13
New changeset 3dcccd1186febe0bca5936aed750d55c68b78bcd by Miss Islington (bot) in branch '3.8':
bpo-39885: Make IDLE context menu cut and copy work again (GH-18951)
https://github.com/python/cpython/commit/3dcccd1186febe0bca5936aed750d55c68b78bcd
msg370341 - (view) Author: miss-islington (miss-islington) Date: 2020-05-29 23:13
New changeset 9f3f70fd0b6922840b3ef8018c446a6c8ac74ece by Miss Islington (bot) in branch '3.9':
bpo-39885: Make IDLE context menu cut and copy work again (GH-18951)
https://github.com/python/cpython/commit/9f3f70fd0b6922840b3ef8018c446a6c8ac74ece
History Date User Action Args 2022-04-11 14:59:27adminsetgithub: 84066 2020-05-29 23:31:23terry.reedysetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.10 2020-05-29 23:13:25miss-islingtonsetmessages: + msg370341 2020-05-29 23:13:03miss-islingtonsetmessages: + msg370340 2020-05-29 23:11:35miss-islingtonsetmessages: + msg370339 2020-05-29 22:54:42miss-islingtonsetpull_requests: + pull_request19768 2020-05-29 22:54:35miss-islingtonsetpull_requests: + pull_request19767 2020-05-29 22:54:28miss-islingtonsetpull_requests: + pull_request19766 2020-05-29 22:54:18terry.reedysetmessages: + msg370337 2020-03-12 03:52:05terry.reedysetstage: needs patch -> patch review
pull_requests: + pull_request18302 2020-03-12 03:15:16terry.reedysettitle: IDLE right click should clear any selection -> IDLE right click outside of any selection should clear it 2020-03-12 03:14:27terry.reedysetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg363991

stage: resolved -> needs patch

2020-03-08 21:53:00terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved 2020-03-08 19:47:09miss-islingtonsetmessages: + msg363677 2020-03-08 19:46:41miss-islingtonsetmessages: + msg363676 2020-03-08 19:30:21miss-islingtonsetpull_requests: + pull_request18218 2020-03-08 19:30:15miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request18217
2020-03-08 19:30:08terry.reedysetmessages: + msg363675 2020-03-08 18:57:34terry.reedysetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request18216 2020-03-07 05:29:07terry.reedysetmessages: + msg363581 2020-03-07 05:17:21terry.reedysetmessages: + msg363580
title: IDLE right click should unselect -> IDLE right click should clear any selection 2020-03-07 05:11:38terry.reedysetmessages: + msg363578 2020-03-07 05:08:09terry.reedycreate