prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Renderer always subtracts one from the terminal width, leaving a column unoccupied
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
The renderer always subtracts one from the terminal width, leaving a column on the right unoccupied. This is a column that the application could be using (and seemingly has no reason to avoid), and looks ugly.
This monkey-patch seems to work perfectly fine, for fullscreen and non-fullscreen applications:
old_get_size = app.output.get_size
def new_get_size():
size = old_get_size()
return Size(size.rows, size.columns + 1)
app.output.get_size = new_get_size
Perhaps prompt-toolkit used to rely on some cursor positioning detail that required a workaround, but that doesn't seem to be the case anymore. I propose simply removing the - 1 altogether. Is there even any reason to keep it?
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 in src/prompt_toolkit/renderer.py at lines 199-200 and inspect why one column is subtracted from the terminal width. Reproduce the behavior in fullscreen and non-fullscreen applications, then verify that removing the subtraction uses the final terminal column without breaking cursor positioning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100