This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Idle: conflict between loop execution and undo shortcut.
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Davide Okami, terry.reedy
Priority: normal Keywords:

Created on 2015-03-09 06:18 by Davide Okami, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
Schermata 2015-03-09 alle 06.53.21.png Davide Okami, 2015-03-09 06:18 Screenshot [2]
Messages (4)
msg237594 - (view) Author: Davide Okami (Davide Okami) Date: 2015-03-09 06:18
Keeping pressed the undo shortcut during a cycle until returning to the cycle declaration, IDLE will react deleting the declaration [1] or overlaying it on the result/s [2] ([2] intermittently and un-effectively on cycle execution).
msg237599 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-03-09 07:11
(Duplicate message unlinked).  I do not know what you mean by a 'cycle', 'generic cycle', or 'cycle declaration'.  Python's only declarations are global and nonlocal statements.  The image does not help me except to specify OSX (latest version) an 3.4.2.  Please describe what you actually did in enough detail that I could do the same.  What is the undo shortcut on OSX, or specifically your machine?
msg237601 - (view) Author: Davide Okami (Davide Okami) Date: 2015-03-09 08:12
Sorry for my bad technical acknowledgment, i will try to be more understandable.
Declaring a while loop statement, and launching the loop pressing enter, it is possible to delete loop results and return to the while declaration statement deleting it [1] or it's possibile to make it disappear from the line in which it was declared [2] [[2] making it appear on the loop result (overlaying it)] without breaking the loop execution [1][2]. Both are possible keeping pressed the shortcut command+z (⌘+z) after that loop runs (keeping it pressed until the loop statement is reached and deleted [1], or keeping it pressed for a little less time than before, to manifest the second behavior). The bug afflicts Python IDLE for OS X (i tried with a clean installation of Python 3.4.3 and i tried it also on Windows without results) in versions 2.7.8, 3.4.x (as i tried).
msg237701 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-03-09 20:01
I believe you are reporting the following behavior, which I believe I have seen before but which seems not to be the subject of a tracker issue.  If I run

import time
for i in range(20):
	print(i)
	time.sleep(.5)

either in Shell at >>> or from the editor, and hold Undo (^Z for me on Windows), output is deleted back to the previous >>>.  When the statements are enter in Shell, that means erasing the visible 'for' statement.  A bit to my surprise, <<Prev>> (alt-P for me) still reloads the 'for' statement.

While this behavior is entirely avoidable by users (don't hit Undo after Enter), I agree that it is not desirable.  At minimum, it should be possible to clear the undo buffer when code is submitted for execution, just as it is when >>> is printed.  That should prevent removal of the entered statement.

I believe Undo is left active during execution so it will be active during user entry in response to input('prompt').  Also, one can start entering input before 'prompt' is printed. So avoiding adding output to Undo would be trickier.

--
Please don't fiddle with the Versions: settings.  This is not a security issue, any change will be applied to 3.5.
History
Date User Action Args
2022-04-11 14:58:13adminsetgithub: 67804
2020-06-07 22:17:44terry.reedysetnosy: - kbk, roger.serwy

versions: + Python 3.10, - Python 3.6, Python 3.7
2017-06-23 06:47:19terry.reedysetassignee: terry.reedy
versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.4, Python 3.5
2015-03-09 20:01:31terry.reedysetmessages: + msg237701
versions: + Python 3.5, - Python 3.2, Python 3.3
2015-03-09 08:12:44Davide Okamisetversions: + Python 3.2, Python 3.3, - Python 3.5
messages: + msg237601
title: Idle: conflict between generic cycle and undo shortcut. -> Idle: conflict between loop execution and undo shortcut.
2015-03-09 07:11:58terry.reedysettitle: Conflict between generic cycle and undo shortcut. -> Idle: conflict between generic cycle and undo shortcut.
stage: test needed
messages: + msg237599
versions: - Python 3.2, Python 3.3, Python 3.6
2015-03-09 07:03:52terry.reedysetmessages: - msg237595
2015-03-09 06:54:24SilentGhostsetnosy: + terry.reedy, kbk, roger.serwy
2015-03-09 06:23:15Davide Okamisetfiles: - Schermata 2015-03-09 alle 06.53.21.png
2015-03-09 06:22:38Davide Okamisetfiles: + Schermata 2015-03-09 alle 06.53.21.png

messages: + msg237595
title: Python IDLE (2.-3.) -> Conflict between generic cycle and undo shortcut.
2015-03-09 06:18:26Davide Okamicreate