Skip to content

Flush pending HTML text before resetting terminal styles - #95

Open
ShahadatTest wants to merge 1 commit into
xolox:masterfrom
ShahadatTest:fix/html-close-flush-order
Open

ShahadatTest wants to merge 1 commit into
xolox:masterfrom
ShahadatTest:fix/html-close-flush-order

Conversation

@ShahadatTest

Copy link
Copy Markdown

HTMLParser buffers incomplete character references until close(). HTMLConverter currently resets terminal styles before that final flush. For example, tail & emits its text after the bold style has already ended. Flush the parser first, then reset remaining styles in a finally block so a callback exception still closes the terminal style.

Both new buffered-tail and streaming-close regressions fail against original master. After the fix, those two tests, a callback-error cleanup control and the existing HTML test all pass. Coverage includes eight bold/italic/code/color buffered tails, streaming input, repeated close and unstyled text. The same behavior checks pass independently on Python 3.10. Flake8 and diff checks pass.

Full Python 3.12 unittest run: 72 tests, with the same 1 failure and 5 errors as pristine master's 69-test run on this Windows host (HOME/path checks, terminal/CLI capture and MockedProgram). No clean full suite or historical Python 2.7-3.9 matrix is claimed. This fixes parser finalization, independently of pending #92's color parsing and #93's anchor capture.

Found through source inspection and local reproduction for Aro 2ta koro (make two more contributions). Prepared with OpenAI Codex (GPT-6) assistance, including investigation, implementation, testing and PR preparation. No personal production usage or human code review is claimed.

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