Skip to content

fix: preserve wrapped input display in colored prompts - #536

Open
Unilinear wants to merge 1 commit into
shareAI-lab:mainfrom
Unilinear:fix/readline-prompt-wrap
Open

fix: preserve wrapped input display in colored prompts#536
Unilinear wants to merge 1 commit into
shareAI-lab:mainfrom
Unilinear:fix/readline-prompt-wrap

Conversation

@Unilinear

Copy link
Copy Markdown

Fixes #535.

Summary

  • Mark ANSI color escape sequences in the interactive prompts as non-printing Readline spans.
  • Apply the fix consistently to the current course files from s01 through s12.
  • Regenerate the web version data so embedded chapter sources stay in sync.

Readline otherwise includes the raw ANSI bytes when calculating the visible prompt width. Once input wraps, that incorrect width causes cursor redraws to overwrite the previous visual line even though the underlying input remains intact.

Testing

  • python -m compileall -q s01_agent_loop ... s12_cron_scheduler
  • git diff --check
  • npx tsc --noEmit
  • npm run build
  • python -m pytest tests -q: 222 passed; the unrelated test_s16_scenario_matches_the_deterministic_runtime progress-order assertion failed in this environment. This change does not touch the s16 runtime or scenario.

AI assistance

I used an AI coding assistant to help diagnose the Readline cursor-width issue, apply the repetitive chapter updates, run checks, and prepare this issue and PR. The rendering problem was encountered directly while working through the course, and the resulting diff was kept focused on that problem.

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.

fix: prevent colored input prompts from overwriting wrapped lines

1 participant