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

Column menu spaces don't respect special characters (accents, emojis...) #793

Closed
Jiogo18 opened this issue May 26, 2024 · 0 comments · Fixed by #794
Closed

Column menu spaces don't respect special characters (accents, emojis...) #793

Jiogo18 opened this issue May 26, 2024 · 0 comments · Fixed by #794
Labels
bug Something isn't working

Comments

@Jiogo18
Copy link
Contributor

Jiogo18 commented May 26, 2024

Platform Arch Linux
Terminal software Konsole with nushell

Completion results can be shifted when a file/folder contains accents or emojis in nushell.

Steps to reproduce

With reedline

  1. Add the following commands in examples/completions.rs
        "file0a".into(),
        "file0b".into(),
        "file0é".into(),
        "file1a".into(),
        "file1é".into(),
        "file2a".into(),
        "file2éééééééé".into(),
        "file3a".into(),
  1. Run cargo run --example completions
  2. Type f[TAB]
  3. The columns are missing spaces for results with accents

With nushell

  1. touch file0a file0b file0é file1a file1📁 file2a file2📁📁📁📁📁 file3a
  2. ./[TAB] (if it doesn't work, use ls [TAB] or similar)
  3. Same result

Screenshots/Screencaptures

image
image

Additional context

Changing .len() to .width() fix this

let empty_space = self.get_width().saturating_sub(suggestion.value.len());

Other .len() call could be replaced by .width() in this file:

  • longest_suggestion
  • shortest_base_string (in case all the results contains lots of special characters)
  • maybe marker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant