Merged
Conversation
Add prompt sanitization to clear stale terminal line state after abnormal exits, preventing prompt artifacts.
severin-richner
pushed a commit
to severin-richner/omarchy
that referenced
this pull request
Feb 11, 2026
Add prompt sanitization to clear stale terminal line state after abnormal exits, preventing prompt artifacts.
antonovch
pushed a commit
to antonovch/omarchy
that referenced
this pull request
Feb 13, 2026
Add prompt sanitization to clear stale terminal line state after abnormal exits, preventing prompt artifacts.
antonovch
pushed a commit
to antonovch/omarchy
that referenced
this pull request
Feb 13, 2026
Add prompt sanitization to clear stale terminal line state after abnormal exits, preventing prompt artifacts.
Member
|
This has a worse side effect: #4783. Reverting. |
Contributor
Author
|
My bad! As it turns out, there’s a good reason for Starship’s default With PS1-style prompts in bash and zsh, the line editor (Readline / ZLE) owns the line state and effectively “sanitizes” it, so there’s no need for an extra newline. I was trying to make Starship feel more like that, but since it just writes to stdout without access to the internal line state, that led me to a hacky workaround that only made things worse. Sorry about that! It seems the only reliable way to guarantee a clean prompt is to accept the newline default (or switch back to PS1). |
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
Adds prompt sanitization to clear stale terminal line state after abnormal exits, preventing prompt artifacts.
In some cases, exiting a program abruptly can leave residual output on the current terminal line, causing the next prompt to render incorrectly. This change ensures the prompt is always drawn on a clean line.
Example
iex # press Ctrl-\Exiting
iexwithCtrl-\sendsSIGQUIT, which terminates the process without restoring terminal display state. When control returns to the shell, leftover output may remain on the line.This behavior is not specific to IEx; any program that exits without cleaning up the terminal line can trigger it.
Fix
Starship assumes a clean terminal line when rendering the prompt and does not perform line hygiene itself. Before rendering the prompt, the shell now resets the cursor position and clears the current line, preventing prompt corruption regardless of how the previous process exited.