Skip to content

Skip unstyled spaces on empty terminal rows - #2180

Open
Boulea7 wants to merge 1 commit into
prompt-toolkit:mainfrom
Boulea7:fix/2008-blank-terminal-cells
Open

Boulea7 wants to merge 1 commit into
prompt-toolkit:mainfrom
Boulea7:fix/2008-blank-terminal-cells

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 3, 2026

Copy link
Copy Markdown

Fixes #2008.

An empty prompt row can write an unstyled space and immediately back up when the renderer sees two different style labels for the same blank cell. This skips that write when both styles are visually empty. First-column text, styled spaces, clearing old content, and zero-width escapes still take their existing paths.

The renderer diagnosis in #2088 by afonsojanu informed this fix.

I reproduced the extra writes through PromptSession on macOS and Linux VT100 PTYs and in tmux 3.8. The regression covers a blank prompt, a blank line before a single character, a space with a visible background, and erasing the last typed character. All 160 tests passed on macOS. Ruff and strict mypy also passed.

AI-assisted with Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unwanted empty space at end of output

1 participant