-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wicket] correctly wrap popup text within step logs (#3081)
Previously, we were relying on tui's paragraph wrap functionality. This had several limitations: 1. There's no way to obtain the actual height of the text as computed. This meant that wrapped text was previously cut off. 3. There's no sensible way to implement scrolling. To address these issues, we implement wrapping ourselves, via the textwrap library. The library exposes support for wrapping strings, but we're working with tui Spans (which have styles associated with them) so we have to do some work ourselves. Thankfully, it isn't too much work: textwrap exposes an abstract interface called `Fragment`, so it's mostly a matter of copy-pasting some code from textwrap, and annotating each word with its corresponding tui style. This PR does not implement scrolling, but now that we're working with pre-wrapped text in the popup, scrolling should be pretty simple to do in a followup. Screenshot of wrapped text: ![image](https://github.com/oxidecomputer/omicron/assets/180618/fb204b3a-3917-4e9d-bec8-4edb88c6cfdd)
- Loading branch information
1 parent
72b5757
commit 8b0ab46
Showing
7 changed files
with
441 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.