@Override protected final boolean execute(@NotNull Editor editor, @NotNull DataContext dataContext, @NotNull Command cmd) { // EditorActionHandlerBase inheritors should override the 3-arg execute if they do not run for each caret and // the 4-arg execute if they do. This is the 3-arg version for the "one-off" actions. return execute(editor, editor.getCaretModel().getPrimaryCaret(), dataContext, cmd); }
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd, @NotNull TextRange range) throws ExecuteMethodNotOverriddenException { if (!myRunForEachCaret) { throw new ExecuteMethodNotOverriddenException(this.getClass()); } return execute(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd, range); }
/** * @deprecated To move the caret, use {@link #moveCaretToLineEndOffset(Editor, Caret, int, boolean)} */ public int moveCaretToLineEndOffset(@NotNull Editor editor, int cntForward, boolean allowPastEnd) { return moveCaretToLineEndOffset(editor, editor.getCaretModel().getPrimaryCaret(), cntForward, allowPastEnd); }
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) throws ExecuteMethodNotOverriddenException { if (!myIsMulticaretChangeAction) { throw new ExecuteMethodNotOverriddenException(this.getClass()); } return execute(editor, editor.getCaretModel().getPrimaryCaret(), context, count, rawCount, argument); }
/** * This gets the last column the primary cursor was in for the editor. * * @param editor The editor to get the last column from * @return Returns the last column as set by {@link #setLastColumn} or the current primary cursor column * @deprecated Use {@link CaretData#getLastColumn(Caret)} to get the primary cursor last column */ public static int getLastColumn(@NotNull Editor editor) { return CaretData.getLastColumn(editor.getCaretModel().getPrimaryCaret()); }
/** * @deprecated To move the caret, use {@link #moveCaretToLineStartSkipLeading(Editor, Caret)} */ public int moveCaretToLineStartSkipLeading(@NotNull Editor editor) { return moveCaretToLineStartSkipLeading(editor, editor.getCaretModel().getPrimaryCaret()); }
/** * @deprecated Use {@link #findNextParagraphLine(Editor, Caret, int, boolean)} */ public static int findNextSentenceStart(@NotNull Editor editor, int count, boolean countCurrent, boolean requireAll) { return findNextSentenceStart(editor, editor.getCaretModel().getPrimaryCaret(), count, countCurrent, requireAll); }
/** * @deprecated To move the caret, use {@link #moveCaretToLineStartSkipLeadingOffset(Editor, Caret, int)} */ public int moveCaretToLineStartSkipLeadingOffset(@NotNull Editor editor, int linesOffset) { return moveCaretToLineStartSkipLeadingOffset(editor, editor.getCaretModel().getPrimaryCaret(), linesOffset); }
/** * @deprecated Use {@link #moveCaretToLineEnd(Editor, Caret)} */ public int moveCaretToLineEnd(@NotNull Editor editor) { return moveCaretToLineEnd(editor, editor.getCaretModel().getPrimaryCaret()); }
/** * @deprecated To move the caret, use {@link #moveCaretToLineStart(Editor, Caret)} */ public int moveCaretToLineStart(@NotNull Editor editor) { return moveCaretToLineStart(editor, editor.getCaretModel().getPrimaryCaret()); }
/** * Sets the last column for the primary caret of this editor * * @param col The column * @param editor The editor * @deprecated Use {@link CaretData#setLastColumn(Editor, Caret, int)} to set the caret last column */ public static void setLastColumn(@NotNull Editor editor, int col) { CaretData.setLastColumn(editor, editor.getCaretModel().getPrimaryCaret(), col); }
/** * @deprecated Use {@link #findNextParagraphLine(Editor, Caret, int, boolean)} */ private static int findNextParagraphLine(@NotNull Editor editor, int count, boolean allowBlanks) { return findNextParagraphLine(editor, editor.getCaretModel().getPrimaryCaret(), count, allowBlanks); }
/** * @deprecated To move the caret, use {@link #moveCaretToColumn(Editor, Caret, int, boolean)} */ public int moveCaretToColumn(@NotNull Editor editor, int count, boolean allowEnd) { return moveCaretToColumn(editor, editor.getCaretModel().getPrimaryCaret(), count, allowEnd); }
public int getOffset(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) throws ExecuteMethodNotOverriddenException { if (!myRunForEachCaret) { throw new ExecuteMethodNotOverriddenException(this.getClass()); } return getOffset(editor, editor.getCaretModel().getPrimaryCaret(), context, count, rawCount, argument); }
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) throws ExecuteMethodNotOverriddenException { if (!myRunForEachCaret) { throw new ExecuteMethodNotOverriddenException(this.getClass()); } return execute(editor, editor.getCaretModel().getPrimaryCaret(), context, cmd); }
/** * @deprecated To find the next paragraph, use {@link #findNextParagraph(Editor, Caret, int, boolean)} */ public static int findNextParagraph(@NotNull Editor editor, int count, boolean allowBlanks) { return findNextParagraph(editor, editor.getCaretModel().getPrimaryCaret(), count, allowBlanks); }
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { final LineRange range = new LineRange(0, EditorHelper.getLineCount(editor) - 1); return VimPlugin.getSearch().searchAndReplace(editor, editor.getCaretModel().getPrimaryCaret(), range, "s", "//~/&"); } }
private void restoreCursor(@NotNull Editor editor, @NotNull Caret caret, int startLine) { if (caret != editor.getCaretModel().getPrimaryCaret()) { editor.getCaretModel().addCaret( editor.offsetToVisualPosition(VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor, startLine)), false); } }
/** * Begin insert at the location of the previous insert * * @param editor The editor to insert into */ public void insertAtPreviousInsert(@NotNull Editor editor, @NotNull DataContext context) { editor.getCaretModel().removeSecondaryCarets(); final Caret caret = editor.getCaretModel().getPrimaryCaret(); final int offset = VimPlugin.getMotion().moveCaretToMark(editor, '^', false); if (offset != -1) { MotionGroup.moveCaret(editor, caret, offset); } insertAfterCursor(editor, context); }
public boolean swapVisualBlockEnds(@NotNull Editor editor) { if (!CommandState.inVisualBlockMode(editor)) return false; int t = EditorData.getVisualBlockEnd(editor); EditorData.setVisualBlockEnd(editor, EditorData.getVisualBlockStart(editor)); EditorData.setVisualBlockStart(editor, t); moveCaret(editor, editor.getCaretModel().getPrimaryCaret(), EditorData.getVisualBlockEnd(editor)); return true; }