Skip to content

Fix ellipsis encoding in the text layout - #809

Merged
penguinolog merged 1 commit into
urwid:masterfrom
penguinolog:text_layout_encoding
Feb 16, 2024
Merged

penguinolog merged 1 commit into
urwid:masterfrom
penguinolog:text_layout_encoding

Conversation

@penguinolog

Copy link
Copy Markdown
Collaborator
Checklist
  • I've ensured that similar functionality has not already been implemented
  • I've ensured that similar functionality has not earlier been proposed and declined
  • I've branched off the master or python-dual-support branch
  • I've merged fresh upstream into my branch recently
  • I've ran tox successfully in local environment
  • I've included docstrings and/or documentation and/or examples for my code (if this is a new feature)

* Use `...` substitution in case of `…` encoding fails and cache result
* * do not encode multiple times the same value
* * handle unsupported encodings
@penguinolog penguinolog added the Unicode Issues related to Unicode <-> bytes conversion label Feb 16, 2024
@penguinolog
penguinolog requested a review from wardi February 16, 2024 09:25
@github-actions github-actions Bot added the Tests Tests label Feb 16, 2024
@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 7928555744

Details

  • 0 of 19 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 71.213%

Totals Coverage Status
Change from base Build 7927756327: 0.1%
Covered Lines: 8925
Relevant Lines: 12631

💛 - Coveralls

@penguinolog
penguinolog merged commit d8a0e5e into urwid:master Feb 16, 2024
@penguinolog
penguinolog deleted the text_layout_encoding branch February 16, 2024 11:35
@AnonymouX47

AnonymouX47 commented Feb 16, 2024 •

Copy link
Copy Markdown
Contributor

EDIT: Never mind... Will open a new issue.


CanvasError is raised when ... (triple period) is used and 1 <= maxcols < 3 e.g

import urwid
urwid.set_encoding("ascii")
text = urwid.Text("Cool", wrap="ellipsis")
text.render((2,))

results in

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

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

Thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Tests Tests Unicode Issues related to Unicode <-> bytes conversion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ellipsis wrap mode is supported only for UTF and limited list of other encodings

3 participants