Skip to content
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

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

bestgopher
Copy link
Contributor

No description provided.

@djc
Copy link
Member

djc commented Feb 20, 2025

Thanks, this looks good. Can you add a test?

@bestgopher
Copy link
Contributor Author

Thanks, this looks good. Can you add a test?

Are there any examples for reference?

@djc
Copy link
Member

djc commented Feb 26, 2025

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 {
Copy link
Member

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.

Copy link
Contributor Author

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).

Copy link
Member

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?

Copy link
Contributor Author

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.

@djc
Copy link
Member

djc commented Feb 26, 2025

(If you rebase on main, CI should pass.)

@djc djc merged commit d266d59 into console-rs:main Feb 26, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants