reedline icon indicating copy to clipboard operation
reedline copied to clipboard

Fix wrong unit when split string

Open petricavalry opened this issue 1 year ago • 2 comments

Fixes #837.

https://github.com/nushell/reedline/blob/4634f71705785a772c894aa45e30db88f3c7a8d5/src/menu/columnar_menu.rs#L305

split_at expect byte offset.

https://github.com/nushell/reedline/blob/4634f71705785a772c894aa45e30db88f3c7a8d5/src/menu/columnar_menu.rs#L302

But we given (got from width) isn't.

Thanks for all amazing works in reedline.

petricavalry avatar Sep 30 '24 11:09 petricavalry

Yeah for anything involving string splitting .len is the relevant thing to get to the indices, while .width serves as a best guess for the layout width in the terminal. We need to be sure that the right thing is used in the right place.

There seems to be some preexisting history of display bugs leading to this

  • #793
  • #794

sholderbach avatar Sep 30 '24 12:09 sholderbach

Thanks for your help. I can't reproduce #793 after change this line. match_len is used only to split string.

ghost avatar Sep 30 '24 13:09 ghost

Works well, sorry about that.

The comment I wrote in #794 doesn't make sense, it is about str_len

shortest_base_string (in case all the results contains lots of special characters)

Jiogo18 avatar Nov 07 '24 00:11 Jiogo18

Thx for the fix!

sholderbach avatar Nov 07 '24 11:11 sholderbach