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.
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,
Copycopies exactly those 3 lines.Copy with Promptsshould 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.