Skip to content
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: fix Shell context menu copy-with-prompts bug #95511

Closed
terryjreedy opened this issue Aug 1, 2022 · 0 comments
Closed

IDLE: fix Shell context menu copy-with-prompts bug #95511

terryjreedy opened this issue Aug 1, 2022 · 0 comments
Assignees
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

terryjreedy commented Aug 1, 2022

If one selects whole lines, as the sidebar makes easy, the next line, if any, is also copied. If the next screen line has a '>>>' prompt with no input, the prompt is added anyway. Given 3 selected lines followed by a prompt,

>>> if 1: print 2
... 
    2
>>> |

Copy copies exactly those 3 lines. Copy with Prompts should only add prompts for those 3 lines and not add the second primary prompt, whether or not followed by any test.

The solution is to test sel.last and only move it to the beginning of the next line when it is not already at the beginning of a line or potential line, as it is above.

@terryjreedy terryjreedy added type-bug An unexpected behavior, bug, or error topic-IDLE 3.11 only security fixes 3.10 only security fixes 3.12 bugs and security fixes labels Aug 1, 2022
@terryjreedy terryjreedy self-assigned this Aug 1, 2022
terryjreedy added a commit to terryjreedy/cpython that referenced this issue Aug 1, 2022
If one selects whole lines, as the sidebar makes easy, do not
add an extra line.  Only move the end of a selection to the
beginning of the next line when not already at the beginning
of a line.  (Also improve the surrounding code.)
terryjreedy added a commit that referenced this issue Aug 1, 2022
If one selects whole lines, as the sidebar makes easy, do not
add an extra line.  Only move the end of a selection to the
beginning of the next line when not already at the beginning
of a line.  (Also improve the surrounding code.)
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 1, 2022
…ythonGH-95512)

If one selects whole lines, as the sidebar makes easy, do not
add an extra line.  Only move the end of a selection to the
beginning of the next line when not already at the beginning
of a line.  (Also improve the surrounding code.)
(cherry picked from commit fc31a13)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 1, 2022
…ythonGH-95512)

If one selects whole lines, as the sidebar makes easy, do not
add an extra line.  Only move the end of a selection to the
beginning of the next line when not already at the beginning
of a line.  (Also improve the surrounding code.)
(cherry picked from commit fc31a13)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington added a commit that referenced this issue Aug 1, 2022
If one selects whole lines, as the sidebar makes easy, do not
add an extra line.  Only move the end of a selection to the
beginning of the next line when not already at the beginning
of a line.  (Also improve the surrounding code.)
(cherry picked from commit fc31a13)

Co-authored-by: Terry Jan Reedy <[email protected]>
miss-islington added a commit that referenced this issue Aug 1, 2022
If one selects whole lines, as the sidebar makes easy, do not
add an extra line.  Only move the end of a selection to the
beginning of the next line when not already at the beginning
of a line.  (Also improve the surrounding code.)
(cherry picked from commit fc31a13)

Co-authored-by: Terry Jan Reedy <[email protected]>
@terryjreedy terryjreedy moved this to Done in IDLE Issues Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

1 participant