@Override
  public @Nullable String getSelectedText() {
    if (!hasSelection()) {
      return null;
    }
    SelectionMarker selectionMarker = mySelectionMarker;
    CharSequence text = myEditor.getDocument().getCharsSequence();
    int selectionStart = getSelectionStart();
    int selectionEnd = getSelectionEnd();
    String selectedText = text.subSequence(selectionStart, selectionEnd).toString();
    if (isVirtualSelectionEnabled() && selectionMarker.hasVirtualSelection()) {
      int padding = selectionMarker.endVirtualOffset - selectionMarker.startVirtualOffset;
      StringBuilder builder = new StringBuilder(selectedText.length() + padding);
      builder.append(selectedText);
      for (int i = 0; i < padding; i++) {
        builder.append(' ');
      }
      return builder.toString();
    }
    else {
      return selectedText;
    }
  }
@Override
  public @Nullable String getSelectedText()