Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
input: Take care of index and width separately
This resolves #26, where inserting into a string outside character boundary leads to a panic (ref: https://doc.rust-lang.org/std/string/struct.String.html#method.insert) ""Panics if idx is larger than the String's length, or if it does not lie on a char boundary."" We use `char_indices` to find the correct position to insert into and `unicode_width` crate to find out the width of characters.
- Loading branch information
1 parent
1bdc396
commit 804764d
Showing
4 changed files
with
37 additions
and
11 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