Skip to content

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

Closed
@terryjreedy

Description

@terryjreedy

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.

Metadata

Metadata

Assignees

Labels

3.10only security fixes3.11only security fixes3.12only security fixestopic-IDLEtype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions