public TextWithMnemonic replaceFirst(@NotNull String target, @Nls @NotNull String replacement) {
    int index = text.indexOf(target);
    if (index == -1) {
      return this;
    }
    String resultText = text.substring(0, index) + replacement + text.substring(index + target.length());
    int resultIndex = mnemonicIndex < index ? mnemonicIndex :
                      mnemonicIndex >= index + target.length() ? mnemonicIndex - target.length() + replacement.length() :
                      -1;
    return new TextWithMnemonic(resultText, resultIndex, mnemonicSuffix);
  }
public TextWithMnemonic replaceFirst(@NotNull String target, @Nls @NotNull String replacement)