Repository navigation
IDLE: Move prompts with input. #75512
Description
Activity
When this program (from thread by Steven D'Aprano) on python-list is run
import time from threading import Timer def do_work(): x = 2 + 2 print("It is", time.asctime(), "and 2+2 is", x) def go(): Timer(10, do_work, ()).start() # schedule it in one minute
The response, if it occurs while one in entering a statement, 'pushes down' the entry in progress.
======================= RESTART: F:\Python\mypy\tem.py =======================
>>> go() >>> It is Sat Sep 2 19:42:10 2017 and 2+2 is 4 #<== output a = ( 12, # <== 2nd line of entry in progress
The prompt should be pushed down too.
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Sep 2, 2017 minimum reproduce:
>>> from threading import Timer >>> Timer(0.1, lambda: print('hello'), ()).start() >>> 'hello' a = ( 12,
And the expect output should be something like:
>>> from threading import Timer >>> Timer(0.1, lambda: print('hello'), ()).start() >>> 'hello' # No \<enter\> or other key-input >>>
or:
>>> from threading import Timer >>> Timer(0.1, lambda: print('hello'), ()).start() 'hello' >>>
Right?
Or the output should be:
>>> from threading import Timer >>> Timer(0.1, lambda: print('hello'), ()).start() >>> 'hello' >>>
In my example the screen before the output had
>>> go() >>> a = 12,|where '|' is the blinking input cursor. The '\n' terminated print output is inserted after '>>> ' but before the imcomplete statement. When the statement I want it before the prompt, with '\n' appended if necessary. In the minimized example, the result would be
>>> from threading import Timer >>> Timer(0.1, lambda: print('hello'), ()).start() 'hello' >>>
If delayed output 'junk' does not end with '\n', we can get
>>> junkg=4 # 'g' started where the 'j' ends up. >>> g 4
This is buggy as a history listing.
IDLE's current behavior, which keeps user input and program output better separated, is much better than interactive Python in the console Steven used, where the output is placed at the end of the incomplete statement, which is a nuisance.
The first step is to find where text from the user program is inserted into the Shell text box. Then, how is the insertion point moved back -- but just not quite far enough. The solution might then be obvious.
A 'deeper' idea that would solve this (and other issues) is a separate Shell input box (without '>>> ') under the Shell history box. But that is a separate discussion.
This issue remains with prompts moved to a sidebar. I am leaning now to separate input widget.
Since the prompts moved to the sidebar, the prompt is marked by a tag on the newline before the input line, and output arriving at that point was inserted after it. #157706 moves the mark after the output, so the statement being entered keeps its prompt.
Retesting current IDLE: late output is inserted just before the iomark, so IDLE only parses input. If output has no newline, input starts after the output on the same line. If is has final newline, input moves down while the prompt stays still. If there are newlines but no final newline, both problems arise.
Fixed for output that ends with newline.
- added a commit that references this issue
on Sep 21, 2026
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone


Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs