Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Text.render() raises CanvasError for some non-UTF-8 encodings when 1 <= maxcols < 3 #812

Closed
2 of 3 tasks
AnonymouX47 opened this issue Feb 16, 2024 · 0 comments · Fixed by #813
Closed
2 of 3 tasks
Assignees
Labels
bug regression Unicode Issues related to Unicode <-> bytes conversion

Comments

@AnonymouX47
Copy link
Contributor

Description:

CanvasError is raised when ... (triple period) is used and 1 <= maxcols < 3 as in:

urwid.canvas.CanvasError: Canvas text is wider than the maxcol specified:
maxcol=2
widths=[3]
text=[b'...']
urwid target encoding=ascii

Introduced in #809.

Affected versions (if applicable)
  • master branch (9fab329)
  • Latest stable version from pypi
  • Other (specify source)
Steps to reproduce (if applicable)
import urwid
urwid.set_encoding("ascii")
text = urwid.Text("Cool", wrap="ellipsis")
text.render((2,))
Expected outcome

The ellipsis should be truncated or replaced with blanks (spaces).

Might also want to include these edge cases in the tests.

@penguinolog penguinolog self-assigned this Feb 16, 2024
@penguinolog penguinolog added the Unicode Issues related to Unicode <-> bytes conversion label Feb 16, 2024
penguinolog pushed a commit to penguinolog/urwid that referenced this issue Feb 16, 2024
penguinolog added a commit that referenced this issue Feb 16, 2024
Fix: #812

Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug regression Unicode Issues related to Unicode <-> bytes conversion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants