prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Resizing when the application is in a background thread
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
First of all, thanks for making prompt_toolkit available. It's been tremendously useful.
We are working on a small terminal-based full screen application. At the moment, our
app does not handle changes to the terminal size correctly. This appears (as far as I understand) to be because the prompt toolkit application runs in a background thread (source)
and prompt_toolkit only handles SIGWINCH signals if the application is running in the main thread.
Obviously, there are workarounds: we can handle SIGWINCH signals directly and just run app.invalidate(), but we aren't sure whether that's the right thing to do. We had the following questions:
- Any reason why handling
SIGWINCHby callingapp.invalidate()would be a bad idea? - Why restrict handling resizes to when the application is in the main thread?
- Should our application be running in the main thread?
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 reading prompt_toolkit/application/application.py around the SIGWINCH handling cited in the issue, then compare it with the background-thread usage in sml_sync/ui.py. Check how app.invalidate() relates to terminal resize handling and determine the supported behavior for applications running outside the main thread. Done means the resize behavior and recommended approach are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100