void (@NotNull Editor editor, @NotNull LogicalPosition pos) { LogicalPosition logicalPosition = editor.getCaretModel().getLogicalPosition(); if (logicalPosition.line != pos.line) { LOGGER.error("Unexpected caret position: " + logicalPosition + ", target indent position: " + pos); return; } if (pos.column < logicalPosition.column) { int targetOffset = editor.logicalPositionToOffset(pos); int offset = editor.getCaretModel().getOffset(); editor.getCaretModel().getCurrentCaret().setSelection(targetOffset, offset, false); EditorModificationUtilEx.deleteSelectedText(editor); editor.getCaretModel().moveToLogicalPosition(pos); } else if (pos.column > logicalPosition.column) { EditorModificationUtilEx.insertStringAtCaret(editor, StringUtil.repeatSymbol(' ', pos.column - logicalPosition.column)); } }