nushell / reedline

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

Fix panic in long item completion in ide menu #823

Closed HKalbasi closed 2 months ago

HKalbasi commented 2 months ago

Ide menu uses ... for items that are very long, and if the prompt already contains some string inside of ... it will panic. It can be reproduced by completing the largest item in the ide_completions, then deleting one or two characters, and hitting Tab again.

The panic was found in #821

fdncred commented 2 months ago

This is how I was able to repro the bug and test this fix.

  1. cargo run --example ide_completions
  2. h<tab>
  3. the longest entry should now be selected with ... at the end
  4. hit enter
  5. hit backspace
  6. hit tab

Thanks for fixing this. Let's go!