fix(themes/powerline): ensure prompt starts on a new line#2385
Open
seefood wants to merge 2 commits intoBash-it:masterfrom
Open
fix(themes/powerline): ensure prompt starts on a new line#2385seefood wants to merge 2 commits intoBash-it:masterfrom
seefood wants to merge 2 commits intoBash-it:masterfrom
Conversation
When a command's output has no trailing newline, \e[G (column 1) in PS1 would overwrite that output with the prompt. Add a missing-newline indicator in PROMPT_COMMAND: reversed-video % marks the incomplete line, then \r\e[K moves to column 1 and clears it, so the prompt always renders cleanly regardless of the previous command's output. Fixes Bash-it#2372 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verifies that __powerline_prompt_command: - outputs the \e[7m%\e[0m\r\e[K sequence to stdout - outputs it as the very first bytes (before segment/PS1 content) Uses a no-op stub segment and a _save-and-reload-history stub to avoid pulling in every plugin that the default segments depend on. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a command produces output without a trailing newline (e.g.
echo -n foo), the existing\e[G(move to column 1) inPS1overwrites that output with the prompt. This adds a missing-newline handler at the top of__powerline_prompt_command:How it works:
\e[7m%\e[0m— prints a reversed-video%at the current cursor position. If the previous command left the cursor mid-line, this character is briefly visible as a "missing newline" indicator (same convention as zsh'sPROMPT_SP)\r— carriage return to column 1 of the current line\e[K— clear from column 1 to end of lineResult:
%is printed and immediately cleared → no visible change%appears at the end of the partial output, then\r\e[Kclears the entire line → prompt renders cleanly on what is now an empty lineThe existing
\e[GinPS1is kept as-is (it becomes a harmless no-op since we are already at column 1 after theprintf).Note:
powerline-multilineuses\e[B(cursor down) instead of\e[Gand has different behaviour; that theme is out of scope for this fix.Test plan
echo -n foo— verify%appears briefly then prompt renders on a clean new line,foois not overwrittenecho foo,ls) — verify no extra blank line is insertedpowerline,powerline-plain, andpowerline-naked(plain and naked inherit__powerline_prompt_commandfrom base)Fixes #2372
🤖 Generated with Claude Code