Fix: Fix Wrapping Logic in Panels#629
Open
ccubed wants to merge 1 commit into
Open
Conversation
…the panel width. Also add two test cases `AllLinesFitInsideWidth` and `AllLinesFitInsideWidthWithMismatchedWrap`. The first one simply tests that given a large line of text and a small panel width the lines fit within the panel width. The second one tests that passing a larger WrapWidth than the panel width doesn't produce oversized lines.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This fix adjusts the wrapping logic for panels to ensure that effectiveWidth will fit inside the visible panel width. Before this change, it is possible that effectiveWidth would be greater than the visible panel width which would produce misaligned panels. Also add two test cases
AllLinesFitInsideWidthandAllLinesFitInsideWidthWithMismatchedWrap. The first one simply tests that given a large line of text and a small panel width the lines fit within the panel width. The second one tests that passing a larger WrapWidth than the panel width doesn't produce oversized lines.This will still break if your panel width is small enough that we aren't able to split the string into tokens based on the width. I've found that 14 seems to be the minimum size needed to display a panel correctly.
Changes
Provide a bullet point list of noteworthy changes in this Pull Request:
AllLinesFitInsidewidthandAllLinesFitInsideWidthWithMismatchedWraptest cases to test that wrapping applies properly across different situations.renderSingleColumnLinesto verify that effectiveWrap is not larger than the useable panel width.