-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-39852: IDLE 'Go to line' deletes selection, updates status #18801
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
Conversation
Clearing any selection prevents accidental deletion. The update is for Ln and Col on the status bar.
@taleinat @csabella It would be nice to have this tested on Mac and Linux (Ubuntu). A minimal test: in shell, enter something after the prompt and select some of it. Open goto box, enter 2, close by clicking OK Selected text should remain but selection highlight should be gone. Status bar should be updated. Previously, at least on windows, selection highlight remained and status Ln, Col were not updated. For more: Repeat but close with Enter key, and without selection. Everything should work in editor too. Edit: I previously forgot to include the '@'s to get this emailed to you. I plan to merge tomorrow to work on at least one of two other issues touching the function, but testing after merge, or after another patch or two, before the next releases, would still be good. The simulated click is needed, at least on Windows, where selection_clear does not completely clear physical click selections. The more direct code I would have preferred would have been 3 lines instead of 5. |
The patch to idlelib/help.html included changes to idle.rst in #18771 that were not propagated. |
Lib/idlelib/editor.py
Outdated
@@ -678,8 +678,13 @@ def goto_line_event(self, event): | |||
if lineno <= 0: | |||
text.bell() | |||
return "break" | |||
text.mark_set("insert", "%d.0" % lineno) | |||
newindex = f'{lineno}.0' | |||
text.mark_set("insert", newindex ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rogue extra space after newindex
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In response to next comment, I reverted mark_set change.
There's a |
I was not currently aware of it. Since I want .see after .mark_set, I pulled in .tag_remove, which for some reason I did not think was working. But it does here. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. This works on Ubuntu.
Thanks @terryjreedy for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
…nGH-18801) It appears standard that moving the text insert cursor away from a selection clears the selection. Clearing prevents accidental deletion of a possibly off-screen bit of text. The update is for Ln and Col on the status bar. (cherry picked from commit 2522db1) Co-authored-by: Terry Jan Reedy <[email protected]>
GH-18857 is a backport of this pull request to the 3.8 branch. |
GH-18858 is a backport of this pull request to the 3.7 branch. |
…nGH-18801) It appears standard that moving the text insert cursor away from a selection clears the selection. Clearing prevents accidental deletion of a possibly off-screen bit of text. The update is for Ln and Col on the status bar. (cherry picked from commit 2522db1) Co-authored-by: Terry Jan Reedy <[email protected]>
) It appears standard that moving the text insert cursor away from a selection clears the selection. Clearing prevents accidental deletion of a possibly off-screen bit of text. The update is for Ln and Col on the status bar. (cherry picked from commit 2522db1) Co-authored-by: Terry Jan Reedy <[email protected]>
) It appears standard that moving the text insert cursor away from a selection clears the selection. Clearing prevents accidental deletion of a possibly off-screen bit of text. The update is for Ln and Col on the status bar. (cherry picked from commit 2522db1) Co-authored-by: Terry Jan Reedy <[email protected]>
I should remember to use Module Browser to scan the 100+ EditorWindow methods. |
Clearing any selection prevents accidental deletion.
The update is for Ln and Col on the status bar.
https://bugs.python.org/issue39852