Skip to content

test(prompt): pin the boxed PROMPT_COMMAND prompt from #132 - #158

Merged
LESdylan merged 1 commit into
developfrom
test/prompt-command-box
Sep 26, 2026
Merged

LESdylan merged 1 commit into
developfrom
test/prompt-command-box

Conversation

@LESdylan

Copy link
Copy Markdown
Member

What & why

In #132, typing under a two-row boxed prompt ran over the prompt. The report's rc does three things:

  • it builds a coloured, two-row PS1 in a PROMPT_COMMAND function before every prompt;
  • it times commands with a DEBUG trap that forks date;
  • it still had a coloured RPROMPT clock 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.py pins 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 new tests/prompt_command_box_test.py against it. 6 of its 24 checks fail, and they are the failures the report shows:

    • Ctrl-A puts the cursor twelve columns past ❯;
    • a wrapped line leaves a gap and continues at the wrong column;
    • Down after Up does not restore the row.

    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:

    • the prompt fills two rows, with the cursor right after ❯, and the RPROMPT clock sits at the right edge;
    • typed text follows the prompt on its row, and Ctrl-A returns to just after ❯;
    • a line longer than the terminal wraps once, under an intact prompt row;
    • after ^C (✘130) and after 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.
  • 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 pyte and git, 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

🤖 Generated with Claude Code

https://claude.ai/code/session_01RAmeHfJNm7XjYbMNrQqvkG


Generated by Claude Code

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
@LESdylan LESdylan mentioned this pull request Sep 26, 2026
@LESdylan
LESdylan merged commit 9beab62 into develop Sep 26, 2026
17 checks passed
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.

2 participants