@Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      ListSelectionModel sm = myList.getSelectionModel();

      String query = mySearch.getEnteredPrefix();
      if (query == null) return;

      IntList filtered = mySearch.findAllFilteredElements(query);
      if (filtered.isEmpty()) {
        return;
      }

      boolean alreadySelected = Arrays.equals(filtered.toIntArray(), myList.getSelectedIndices());

      if (alreadySelected) {
        int anchor = myList.getAnchorSelectionIndex();

        myList.setSelectedIndex(anchor);
        sm.setAnchorSelectionIndex(anchor);

        mySearch.findAndSelectElement(query);
      }
      else {
        int anchor = -1;
        Object currentElement = mySearch.findElement(query);
        if (currentElement != null) {
          ListIterator<Object> iterator = mySearch.getElementIterator(0);
          while (iterator.hasNext()) {
            if (iterator.next() == currentElement) {
              anchor = iterator.previousIndex();
              break;
            }
          }
        }
        if (anchor == -1) anchor = filtered.getInt(0);

        myList.setSelectedIndices(filtered.toIntArray());
        sm.setAnchorSelectionIndex(anchor);
      }
    }
@Override
    public void actionPerformed(@NotNull AnActionEvent e)