fix(ansi): handle CRLF line endings in AnsiDecoder.decode
When Text.from_ansi() receives a string with CRLF (\r\n) line endings, every line of content is lost — the result is all empty strings.
Root cause: AnsiDecoder.decode() splits on \n, strips trailing \n via .rstrip("\n"), then passes each line to decode_line(), which runs .rsplit("\r", 1)[-1] to handle terminal carriage-return overwrite semantics. When the input has CRLF endings, a bare \r remains after stripping; decode_line interprets that trailing \r as an overwrite and returns the (empty) portion after it.
Fix: strip trailing \r alongside \n in decode(): .rstrip("\n\r").
Reproduction:
from rich.text import Text
# Before fix: plain == '\\n\\n'
# After fix: plain == 'Hello\\nWorld\\n'
Text.from_ansi('Hello\\r\\nWorld\\r\\n').plain
Closes #4090
Your PR has been closed due to a AI policy violation.
Please read the following before submitting further PRs.
https://github.com/Textualize/textual/blob/main/AI_POLICY.md
@willmcgugan
FYI, It appears that this PR is still open.