forked from dandavison/delta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add truncate_str_short() which always returns a prefix of the input
Document that the input of `truncate_str()` may be cut on a double width char ("fullwidth") - then the output is no longer a prefix of the input. `truncate_str_short()` could be faster by not constructing the result and instead only returning an index, but it will be used in rare edge cases so reusing existing logic is good enough. Common code moved to `truncate_str_impl()`. Assume (with fallback) that graphemes are at most 2 wide. Fewer allocations. Tests.
- Loading branch information
1 parent
841d559
commit 6205118
Showing
1 changed file
with
90 additions
and
20 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