Java Code Examples for com.intellij.openapi.editor.Editor#isColumnMode()
The following examples show how to use
com.intellij.openapi.editor.Editor#isColumnMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeleteInColumnModeHandler.java From consulo with Apache License 2.0 | 6 votes |
@RequiredWriteAction @Override public void executeWriteAction(Editor editor, @Nullable Caret caret, DataContext dataContext) { if (editor.isColumnMode() && caret == null && editor.getCaretModel().getCaretCount() > 1) { EditorUIUtil.hideCursorInEditor(editor); CommandProcessor.getInstance().setCurrentCommandGroupId(EditorActionUtil.DELETE_COMMAND_GROUP); CopyPasteManager.getInstance().stopKillRings(); editor.getCaretModel().runForEachCaret(c -> { int offset = c.getOffset(); int lineEndOffset = DocumentUtil.getLineEndOffset(offset, editor.getDocument()); if (offset < lineEndOffset) myOriginalHandler.execute(editor, c, dataContext); }); } else { myOriginalHandler.execute(editor, caret, dataContext); } }
Example 2
Source File: DeleteToWordEndAction.java From consulo with Apache License 2.0 | 6 votes |
@RequiredWriteAction @Override public void executeWriteAction(Editor editor, Caret caret, DataContext dataContext) { CommandProcessor.getInstance().setCurrentCommandGroupId(EditorActionUtil.DELETE_COMMAND_GROUP); CopyPasteManager.getInstance().stopKillRings(); int lineNumber = editor.getCaretModel().getLogicalPosition().line; if (editor.isColumnMode() && editor.getCaretModel().supportsMultipleCarets() && editor.getCaretModel().getOffset() == editor.getDocument().getLineEndOffset(lineNumber)) { return; } boolean camelMode = editor.getSettings().isCamelWords(); if (myNegateCamelMode) { camelMode = !camelMode; } deleteToWordEnd(editor, camelMode); }
Example 3
Source File: ColumnSelectionModePanel.java From consulo with Apache License 2.0 | 5 votes |
private void updateStatus() { if (!myProject.isDisposed()) return; final Editor editor = getFocusedEditor(); if (editor != null && !isOurEditor(editor)) return; if (editor == null || !editor.isColumnMode()) { myTextPanel.setVisible(false); } else { myTextPanel.setVisible(true); myTextPanel.setText(UIBundle.message("status.bar.column.status.text")); myTextPanel.setToolTipText("Column selection mode"); } }
Example 4
Source File: AbstractIndentingBackspaceHandler.java From consulo with Apache License 2.0 | 5 votes |
@Override public void beforeCharDeleted(char c, PsiFile file, Editor editor) { myEnabled = false; if (editor.isColumnMode() || !StringUtil.isWhiteSpace(c)) { return; } SmartBackspaceMode mode = getBackspaceMode(file.getLanguage()); if (mode != myMode) { return; } doBeforeCharDeleted(c, file, editor); myEnabled = true; }
Example 5
Source File: CutLineActionHandler.java From consulo with Apache License 2.0 | 4 votes |
@RequiredWriteAction @Override public void executeWriteAction(Editor editor, @Nullable Caret caret, DataContext dataContext) { if (caret == null) { caret = editor.getCaretModel().getCurrentCaret(); } if (!myIgnoreSelection && caret.hasSelection()) { delete(editor, caret, caret.getSelectionStart(), caret.getSelectionEnd()); return; } final Document doc = editor.getDocument(); int caretOffset = caret.getOffset(); if ((myToLineStart && (caretOffset == 0)) || (!myToLineStart && (caretOffset >= doc.getTextLength()))) { return; } final int lineNumber = doc.getLineNumber(caretOffset); int lineEndOffset = doc.getLineEndOffset(lineNumber); int lineStartOffset = doc.getLineStartOffset(lineNumber); if (editor.isColumnMode() && editor.getCaretModel().supportsMultipleCarets() && caretOffset == (myToLineStart ? lineStartOffset : lineEndOffset)) { return; } int start; int end; if (myToLineStart) { start = lineStartOffset; end = caretOffset; } else { if (caretOffset >= lineEndOffset) { start = lineEndOffset; end = lineEndOffset + 1; } else { start = caretOffset; end = lineEndOffset; if (lineEndOffset < doc.getTextLength() && CharArrayUtil.isEmptyOrSpaces(doc.getCharsSequence(), caretOffset, lineEndOffset)) { end++; } } } delete(editor, caret, start, end); }