@Override
  protected void doBeforeCharDeleted(char c, PsiFile file, Editor editor) {
    Document document = editor.getDocument();
    CharSequence charSequence = document.getImmutableCharSequence();
    CaretModel caretModel = editor.getCaretModel();
    int caretOffset = caretModel.getOffset();
    LogicalPosition pos = caretModel.getLogicalPosition();
    int lineStartOffset = document.getLineStartOffset(pos.line);
    int beforeWhitespaceOffset = CharArrayUtil.shiftBackward(charSequence, caretOffset - 1, " \t") + 1;
    if (beforeWhitespaceOffset != lineStartOffset) {
      myReplacement = null;
      return;
    }
    myReplacement = CodeStyle.getLineIndent(editor, file.getLanguage(), lineStartOffset, true);
    if (myReplacement == null) {
      return;
    }
    int tabSize = CodeStyle.getIndentOptions(file).TAB_SIZE;
    int targetColumn = getWidth(myReplacement, tabSize);
    int endOffset = CharArrayUtil.shiftForward(charSequence, caretOffset, " \t");
    LogicalPosition logicalPosition = caretOffset < endOffset ? editor.offsetToLogicalPosition(endOffset) : pos;
    int currentColumn = logicalPosition.column;
    if (currentColumn > targetColumn) {
      myStartOffset = lineStartOffset;
    }
    else if (logicalPosition.line == 0) {
      myStartOffset = 0;
      myReplacement = "";
    }
    else {
      int prevLineEndOffset = document.getLineEndOffset(logicalPosition.line - 1);
      myStartOffset = CharArrayUtil.shiftBackward(charSequence, prevLineEndOffset - 1, " \t") + 1;
      if (myStartOffset != document.getLineStartOffset(logicalPosition.line - 1) || myStartOffset == 0) {
        int spacing = CodeStyle.getJoinedLinesSpacing(editor, file.getLanguage(), endOffset, true);
        if (spacing < 0) {
          LOG.error("The call `codeStyleFacade.getJoinedLinesSpacing` should not return the negative value");
          spacing = 0;
        }
        myReplacement = StringUtil.repeatSymbol(' ', spacing);
      }
    }
  }
@Override
  protected void doBeforeCharDeleted(char c, PsiFile file, Editor editor)