prompt-toolkit / prompt-toolkit/python-prompt-toolkit
`Renderer.reset` is called 3 times during application startup.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
This results in some output escape sequences to be produced multiple times without reason, like showing the cursor.
Renderer.reset() is called three times when we create/start an application, like ptpython for instance:
- Once
Application.__init__()->Renderer.__init__()->Renderer.reset(). - Once
Application.__init__()->Application.reset()->Renderer.reset(). - Once
Application._run_async()->Application.__init__()->Application.reset()->Renderer.reset().
Each time, we call self.output.show_cursor().
Either we should keep track in the Renderer, which terminal state was changed, and only reset that (cursor shapes changed, cursor hidden/shown, alternate screen entered/left, ...) or we should create the Renderer instance only at the point that the application actually starts in Application._run_async(), so that we only reset once.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Renderer.reset() calls through Application.init(), Application.reset(), and Application._run_async(). Compare the two proposed approaches for avoiding repeated terminal-state resets, using ptpython startup to observe the output. Done means application startup no longer emits duplicate escape sequences such as repeated cursor-display commands.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100