test(prompt): pin the boxed PROMPT_COMMAND prompt from #132 - #158
Merged
Merged
Conversation
The report's rc builds a two-row, coloured PS1 in a PROMPT_COMMAND function before every prompt, times commands with a DEBUG trap that forks `date`, and still had a coloured RPROMPT clock from an earlier zsh attempt. Typing on the second row ran over the prompt: Ctrl-A put the cursor twelve columns past `❯`, and a line that wrapped left a gap and continued at the wrong column. The cause was fixed in 3.1.0 (9347dec): the right prompt was drawn inside the line editor's own prompt string, so the editor believed the prompt was wider than it was. prompt_drift_matrix_test.py pins that cause with a fixed PS1. This test pins the report itself, with the rc as the user had it, in a dirty git repository: - the prompt fills two rows, and the cursor sits right after `❯`; - typed text follows the prompt, and Ctrl-A returns to just after `❯`; - a line longer than the terminal wraps exactly once, under an intact prompt row; - after ^C (✘130) and a missing command (✘127) the wider prompt is whole, and typing follows it; - Up recalls the command after the prompt, and Down restores the screen exactly; - an idle prompt stays where it is. pyte is the judge, not hellish's width model. Both line readers are covered: in-process, and HELLISH_RL_FORK=1. Against 9347dec^, the commit before the fix, 6 of the 24 checks fail, the same failures the report shows. develop passes all 24, in 17 s. Refs #132 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RAmeHfJNm7XjYbMNrQqvkG
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.
What & why
In #132, typing under a two-row boxed prompt ran over the prompt. The report's rc does three things:
PROMPT_COMMANDfunction before every prompt;DEBUGtrap that forksdate;RPROMPTclock left over from an earlier zsh attempt.With that rc, the typed text started over
╰─ ✔ ❯, and a long line ran on over the rows below.It is already fixed on develop. 3.1.0 fixed it in 9347dec ("paint RPROMPT from the redisplay hook, not the prompt string"). The right prompt had been drawn inside the line editor's own prompt string, so the editor believed the prompt was nine columns wider than it was.
prompt_drift_matrix_test.pypins that cause, but only with a fixed PS1. This PR pins the report itself: the rc exactly as the user had it, run in a dirty git repository.No source change. This is a test only.
Refs #132
How I verified it
Reproduced first. I built
9347dec0^, the commit before the fix, and ran the newtests/prompt_command_box_test.pyagainst it. 6 of its 24 checks fail, and they are the failures the report shows:❯;develop passes all 24, in 17 s.
What the test checks, with a terminal emulator (pyte) as the judge rather than hellish's own width model, for both the in-process reader and
HELLISH_RL_FORK=1:❯, and theRPROMPTclock sits at the right edge;❯;✘130) and after a missing command (✘127) the wider prompt is whole, and typing follows it;It is robust under load: every check waits for the state it expects instead of trusting a quiet gap. Four copies run in parallel beside a full local pty suite all passed.
It needs
pyteandgit, which the pty CI job already installs, and it skips cleanly without them. It does not depend on the user being root or not.Notes / trade-offs
$(hx_top)showing literally in the report's zsh variant is by design, since hellish never runs$( )inside a prompt. docs(prompt): say that $( ) is not run in a prompt, and what to do instead #154 now documents that, with the hook pattern to use instead.🤖 Generated with Claude Code
https://claude.ai/code/session_01RAmeHfJNm7XjYbMNrQqvkG
Generated by Claude Code