Skip to content

Honor default cursor-forward counts in ANSI text - #2134

Open
FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-ansi-cuf-default-20261011
Open

FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-ansi-cuf-default-20261011

Conversation

@FanWu-ai

Copy link
Copy Markdown

The ANSI parser inserts no spacing for CUF sequences with an omitted or zero count. Both a\x1b[Cb and a\x1b[0Cb therefore render as ab rather than a b, contrary to the command's one-column default.

Apply that default only in cursor-forward handling. Keep numeric parsing and SGR reset semantics unchanged. Tests cover both CSI encodings, omitted/zero/padded-zero/explicit counts, and color preservation/reset.

Validation: pristine suite 156 passed; 12 regression cases fail on original source; final full suite 176 passed. All configured Ruff, format, typos, three-platform Mypy and pinned hooks pass, as do package builds and strict metadata checks. Prepared with AI assistance. Hosted matrix results remain pending.

AI assistance: OpenAI Codex was used for investigation, implementation, regression tests, and automated validation.
@FanWu-ai
FanWu-ai marked this pull request as ready for review October 11, 2026 17:04
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.

1 participant