neurocyte / flow

Flow Control: a programmer's text editor
MIT License
368 stars 17 forks source link

Index out of bounds on command palette when no command found #12

Closed Andriamanitra closed 3 months ago

Andriamanitra commented 3 months ago

To reproduce:

  1. Open flow welcome screen
  2. Press "p" to Show/Run commands
  3. Type "qq" (or any other combination of characters that doesn't find any command)
  4. Press Enter

In ReleaseFast it was a segmentation fault, but in debug build I got an index out of bounds error:

thread 32035 panic: index out of bounds: index 1, len 1
~/flow/src/tui/Menu.zig:191:51: 0x33ef7b1 in activate_selected (flow)
            const button = self.menu.widgets.items[pos].widget.dynamic_cast(button_type) orelse return;
neurocyte commented 3 months ago

Thanks for the report and fix!