-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 🐛 remove double-width characters correctly #234
Conversation
Thanks, this looks good. Can you add a test? |
Are there any examples for reference? |
Good question -- I guess we don't really do tests in this crate. Ignore my question! |
src/utils.rs
Outdated
@@ -719,7 +719,7 @@ fn str_width(s: &str) -> usize { | |||
} | |||
|
|||
#[cfg(feature = "ansi-parsing")] | |||
fn char_width(c: char) -> usize { | |||
pub fn char_width(c: char) -> usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to make this pub
, please fold the not(feature = "ansi-parsing")
variant into this function (which I think happens implicitly anyway?) and add a docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't consider it carefully. I have now made this function pub(crate).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you don't need it in dialoguer anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you don't need it in dialoguer anymore?
I can add unicode_width
crate in dialoguer.
(If you rebase on main, CI should pass.) |
Signed-off-by: 刘洋 <[email protected]> Signed-off-by: bestgopher <[email protected]>
No description provided.