charmbracelet / gum

A tool for glamorous shell scripts 🎀
MIT License
17.94k stars 339 forks source link

`choose` crashes when in filter mode and you press `spacebar` twice #580

Closed MikaelFangel closed 4 months ago

MikaelFangel commented 4 months ago

Describe the bug When you use choose, press / to filter and then presses spacebar twice it crashed with an index out of bounds error.

To Reproduce Steps to reproduce the behavior:

  1. Run the command gum choose --no-limit x y z
  2. Press / to enter filter
  3. Press spacebar twice
  4. See error

Expected behavior Filter shouldn't crashes from multiple spaces when in filter.

Additional context Error message produced:

Caught panic:

runtime error: index out of range [0] with length 0

Restoring terminal...
MikaelFangel commented 4 months ago

Typing x repeatedly can also crash the program.

meowgorithm commented 2 months ago

Just a note that this is now available in Gum v0.14.2.