reedline icon indicating copy to clipboard operation
reedline copied to clipboard

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

Open Jiogo18 opened this issue 1 year ago • 0 comments

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 https://github.com/nushell/reedline/blob/a580ea56d4e5a889468b2969d2a1534379504ab6/src/menu/columnar_menu.rs#L657

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

Jiogo18 avatar May 26 '24 13:05 Jiogo18