nushell / reedline

A feature-rich line editor - powering Nushell
https://docs.rs/reedline/
MIT License
550 stars 155 forks source link

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

Closed Jiogo18 closed 4 months ago

Jiogo18 commented 6 months ago

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(),
  2. Run cargo run --example completions
  3. Type f[TAB]
  4. 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 https://github.com/nushell/reedline/blob/a580ea56d4e5a889468b2969d2a1534379504ab6/src/menu/columnar_menu.rs#L657

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