-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDLE: Goto should remove selection and update the status bar #84033
Comments
Python 3.8.1 When COPYing text in IDLE, right-click and PASTE behaves like CUT/PASTE This also occurs with COPY -> Go to Line -> PASTE This does not occur with COPY -> left-click -> PASTE |
The standard and expected behavior is that pasting *without* a selection inserts, pasting *with* a selection replaces. Pasting with key, Edit menu, or context menu should be the same. This is what I see and what I *think* you are describing. If so, please close. If not, please specify OS and version, how you installed Python, and more concretely what you did and whether line numbers or code context were present. |
OS: Windows 10 Pro Python 2.7.17 and 3.8.1 were installed from https://www.python.org/downloads/ using the Windows x86-64 executable installer (3.8.1) and Windows x86-64 MSI installer (2.7.17) Both line numbers and code context are not present To reproduce:
Example initial text: # additional line Resulting text in IDLE: # additional line Resulting text in Notepad and Notepad++: # additional line My workaround in IDLE is to add a step between #6 and #7 above, where I mouse click at the desired paste location |
This is much clearer. To expand on what I said before, inserting *anything*, such as by hitting a key, replaces a selection. I verified that this is normal behavior, at least on Windows, with Notepad, Notepad++, and this Firefox entry box I am typing in. So either of your steps 6 or 7 delete the still selected line, after the goto. (And so a click is needed before 6 to stop the deletion.) I see the continued selection as the problem. Both Notepad and Notepad++ unselect any selection upon goto, the same as if one moved the cursor by clicking instead of goto. I will try adding text.selection_clear() to the goto code. |
selection_clear only partially clears a selection. That it does something is proven by selection_clear.py. It disables selection_get. But run the file in IDLE and when it finishes, click the tk window, select a line, click Shell, and manually repeat the last 3 lines. selection_get is disabled again, but upon clicking the title bar of the tk window (to not affect selection in the window), the selection is still highlighted. Further experiments showed that the insertion-deletion bug of this issue remains when using selection_own and selection_clear in IDLE. The alternative of simulating a click on the moved insert cursor is harder by works, at least on Windows. This also triggers a status-bar update -- see bpo-27115. |
I am expanding this issue to include the part of bpo-27115 that the PR will fix. (I will also change the scope of the latter). |
Like goto, right-click also exhibits this behavior. Should selection_clear also be added to right-click code? |
Agreed about right clicks. See new issue bpo-39885. |
I have a nit on the commit message used here (and also in bpo-39885). *Please* don't use this style of commit message "IDLE context menu clears selection". That phrasing sounds like it is the description of a bug. Please always use a phrasing that makes it clear what the commit/PR changes. In this case, for example, it could be "IDLE: make context menu clear selection". I know there are projects that prefer this style. Python is not one of them. Please comply. |
Is it the temporal ambiguity (fixed by adding 'now', which is in the blurbs) or the descriptive versus command style (as with 'Returns' versus 'Return') that you do not like? If the latter, the devguide could use augmentation. The only relevant 'guidance' I found is this descriptive example in https://devguide.python.org/pullrequest/#making-good-commits: "the spam module is now more spammy". This seems similar to "IDLE context menu now clears selection". I don't see anything about commit messages in https://devguide.python.org/committing/, which seems like another likely place for such. |
I guess it's similar to the 'return' vs. 'returns' issue, but I feel much I would have written that as "make the spam module more spammy". Just read |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: