Repository navigation
fix: avoid duplicate zsh prompts on resize - #48
Merged
Raiden-MeixElysia merged 1 commit intoOct 30, 2026
Merged
Conversation
Raiden-MeixElysia
added a commit
that referenced
this pull request
Oct 30, 2026
Raiden-MeixElysia
added a commit
that referenced
this pull request
Oct 30, 2026
Contributor
|
Thanks @zenaurora — shipped in 0.2.1 (https://github.com/ELY-Open-Source/ELYTerminal/releases/tag/v0.2.1). Review found that blanking the prompt's rows erased a background job's output, a continued command's first lines and the prompt without zle, and that the repeated |
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.
Type
What and why
zsh/P10k 在 terminal resize 时会重绘当前 prompt,但旧 prompt 已经被终端网格按新宽度重新排版并进入 history,导致每次缩放都多出一份
Bug details
我使用 p10k + zsh 的情况下,发现如果输入命令之后调整一下终端左右宽度就发现大量的重复 prompt 的输出
使用了一下 GPT6.1 sol 进行了一下修复
zsh 给可重绘 prompt 加上 redraw=1 标记。
终端解析器把这个标记保存在 prompt 的 hyperlink metadata 中。
resize 前识别当前活动 prompt,清除它和输入编辑区域的旧物理行,但保留 prompt 标识。
zsh/P10k 随后只重绘一次,不再把旧 prompt 复制到 history。
我的本机上面没有 powershell ,fish 和 wsl,所以对于 zsh 相关的所有的测试均已经通过.AI 还额外写了一堆测试,如果没必要的话可以删掉这些