-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As it turns out our clipping logic is subtly broken in the presence of multi-byte characters. Because we unconditionally cut off the input string once we exceeded a number of bytes, we may inadvertently violate character boundaries. That in turn can result in a panic being reported. This change fixes the problem by introducing a proper clipping routine that honors graphemes and will only cut off entire graphemes instead of individual bytes. It will also take into account the actual display width of the string as opposed to merely counting bytes.
- Loading branch information
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
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