private static void appendWithColoredMatches(SimpleColoredComponent nameComponent,
                                                 @NotNull @ActionText String name,
                                                 @NotNull @NlsSafe String pattern,
                                                 Color fg,
                                                 boolean selected) {
      SimpleTextAttributes plain = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, fg);

      if (name.startsWith("<html>")) {
        new HtmlToSimpleColoredComponentConverter(HtmlToSimpleColoredComponentConverter.DEFAULT_TAG_HANDLER).appendHtml(nameComponent, name,
                                                                                                                        plain);
        name = nameComponent.getCharSequence(false).toString();
      }
      else {
        nameComponent.append(name, plain);
      }

      nameComponent.setDynamicSearchMatchHighlighting(false);
      if (selected) {
        int matchStart = StringUtil.indexOfIgnoreCase(name, pattern, 0);
        if (matchStart >= 0) {
          nameComponent.setDynamicSearchMatchHighlighting(true);
          List<TextRange> fragments = Collections.singletonList(TextRange.from(matchStart, pattern.length()));
          SpeedSearchUtil.applySpeedSearchHighlighting(nameComponent, fragments, true);
        }
      }
    }
private static void appendWithColoredMatches(SimpleColoredComponent nameComponent,
                                                 @NotNull @ActionText String name,
                                                 @NotNull @NlsSafe String pattern,
                                                 Color fg,
                                                 boolean selected)