prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Renderer always subtracts one from the terminal width, leaving a column unoccupied

Open
#1,758 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

https://github.com/prompt-toolkit/python-prompt-toolkit/blob/5b3dd6dbbd72ac8323e749cc12e6aa2d7c7411af/src/prompt_toolkit/renderer.py#L199-L200

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.