本文整理了Java中com.intellij.openapi.editor.Editor.isOneLineMode()
方法的一些代码示例,展示了Editor.isOneLineMode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Editor.isOneLineMode()
方法的具体详情如下:
包路径:com.intellij.openapi.editor.Editor
类名称:Editor
方法名:isOneLineMode
暂无
代码示例来源:origin: JetBrains/ideavim
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, -1);
}
}
代码示例来源:origin: JetBrains/ideavim
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, true);
}
});
代码示例来源:origin: JetBrains/ideavim
@Override
protected boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context,
@NotNull Command cmd, @NotNull TextRange range) {
return !editor.isOneLineMode() && VimPlugin.getChange().deleteJoinRange(editor, caret, range, false);
}
});
代码示例来源:origin: JetBrains/ideavim
@Override
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) {
if (editor.isOneLineMode()) return false;
return VimPlugin.getChange().blockInsert(editor, context, range, false);
}
});
代码示例来源:origin: JetBrains/ideavim
protected boolean execute(@NotNull Editor editor,
@NotNull DataContext context,
@NotNull Command cmd,
@NotNull TextRange range) {
if (editor.isOneLineMode()) return false;
return VimPlugin.getChange().blockInsert(editor, context, range, true);
}
});
代码示例来源:origin: JetBrains/ideavim
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, true);
}
}
代码示例来源:origin: JetBrains/ideavim
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().deleteJoinLines(editor, caret, count, false);
}
}
代码示例来源:origin: JetBrains/ideavim
@Override
public boolean execute(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count,
int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
return VimPlugin.getChange().insertCharacterAroundCursor(editor, caret, 1);
}
}
代码示例来源:origin: JetBrains/ideavim
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount,
@Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
VimPlugin.getChange().insertNewLineBelow(editor, context);
return true;
}
}
代码示例来源:origin: JetBrains/ideavim
public boolean execute(@NotNull Editor editor, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) {
if (editor.isOneLineMode()) {
return false;
}
VimPlugin.getChange().insertNewLineAbove(editor, context);
return true;
}
}
代码示例来源:origin: JetBrains/ideavim
public void startSearchCommand(@NotNull Editor editor, DataContext context, int count, char leader) {
if (editor.isOneLineMode()) // Don't allow searching in one line editors
{
return;
}
String initText = "";
String label = "" + leader;
ExEntryPanel panel = ExEntryPanel.getInstance();
panel.activate(editor, context, label, initText, count);
}
代码示例来源:origin: JetBrains/ideavim
/**
* This performs the actual insert of the paste
*
* @param editor The editor to paste into
* @param context The data context
* @param startOffset The location within the file to paste the text
* @param text The text to paste
* @param type The type of paste
* @param count The number of times to paste the text
* @param indent True if pasted lines should be autoindented, false if not
* @param cursorAfter If true move cursor to just after pasted text
* @param mode The type of highlight prior to the put.
* @param caret The caret to insert to
*/
public void putText(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, @NotNull String text,
@NotNull SelectionType type, @NotNull CommandState.SubMode mode, int startOffset, int count,
boolean indent, boolean cursorAfter) {
if (mode == CommandState.SubMode.VISUAL_LINE && editor.isOneLineMode()) return;
if (indent && type != SelectionType.LINE_WISE && mode != CommandState.SubMode.VISUAL_LINE) indent = false;
if (type == SelectionType.LINE_WISE && text.length() > 0 && text.charAt(text.length() - 1) != '\n') {
text = text + '\n';
}
final int endOffset = putTextInternal(editor, caret, context, text, type, mode, startOffset, count, indent, cursorAfter);
VimPlugin.getMark().setChangeMarks(editor, new TextRange(startOffset, endOffset));
}
代码示例来源:origin: JetBrains/ideavim
public void startExCommand(@NotNull Editor editor, DataContext context, @NotNull Command cmd) {
if (editor.isOneLineMode()) // Don't allow ex commands in one line editors
{
return;
}
String initText = getRange(editor, cmd);
CommandState.getInstance(editor).pushState(CommandState.Mode.EX_ENTRY, CommandState.SubMode.NONE, MappingMode.CMD_LINE);
ExEntryPanel panel = ExEntryPanel.getInstance();
panel.activate(editor, context, ":", initText, 1);
}
代码示例来源:origin: JetBrains/ideavim
/**
* Inserts a new line below the caret position
*
* @param editor The editor to insert into
* @param caret The caret to insert after
* @param col The column to indent to
*/
private void insertNewLineBelow(@NotNull Editor editor, @NotNull Caret caret, int col) {
if (editor.isOneLineMode()) return;
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretToLineEnd(editor, caret));
EditorData.setChangeSwitchMode(editor, CommandState.Mode.INSERT);
insertText(editor, caret, "\n" + StringUtil.repeat(" ", col));
}
代码示例来源:origin: JetBrains/ideavim
/**
* Begin insert after the current line by creating a new blank line below the current line
* for all carets
*
* @param editor The editor to insert into
* @param context The data context
*/
public void insertNewLineBelow(@NotNull final Editor editor, @NotNull final DataContext context) {
if (editor.isOneLineMode()) return;
for (Caret caret : editor.getCaretModel().getAllCarets()) {
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretToLineEnd(editor, caret));
}
initInsert(editor, context, CommandState.Mode.INSERT);
runEnterAction(editor, context);
}
代码示例来源:origin: JetBrains/ideavim
public boolean execute(@NotNull Editor editor, @NotNull DataContext context,
@NotNull ExCommand cmd) throws ExException {
if (editor.isOneLineMode()) return false;
代码示例来源:origin: JetBrains/ideavim
/**
* Pastes text from the last register into the editor.
*
* @param editor The editor to paste into
* @param context The data context
* @param count The number of times to perform the paste
* @return true if able to paste, false if not
*/
public boolean putText(@NotNull Editor editor, @NotNull DataContext context, int count, boolean indent,
boolean cursorAfter, boolean beforeCursor) {
final Register register = VimPlugin.getRegister().getLastRegister();
if (register == null) return false;
final SelectionType selectionType = register.getType();
if (selectionType == SelectionType.LINE_WISE && editor.isOneLineMode()) return false;
final String text = register.getText();
final List<Caret> carets = EditorHelper.getOrderedCaretsList(editor, beforeCursor ? CaretOrder.INCREASING_OFFSET
: CaretOrder.DECREASING_OFFSET);
for (Caret caret : carets) {
final int startOffset = getStartOffset(editor, caret, selectionType, beforeCursor);
if (text == null) {
VimPlugin.getMark().setMark(editor, MarkGroup.MARK_CHANGE_POS, startOffset);
VimPlugin.getMark().setChangeMarks(editor, new TextRange(startOffset, startOffset));
continue;
}
putText(editor, caret, context, text, selectionType, CommandState.SubMode.NONE, startOffset, count, indent,
cursorAfter);
}
return true;
}
代码示例来源:origin: JetBrains/ideavim
if (register == null) return false;
final SelectionType type = register.getType();
if (type == SelectionType.LINE_WISE && editor.isOneLineMode()) return false;
代码示例来源:origin: JetBrains/ideavim
/**
* Inserts a new line above the caret position
*
* @param editor The editor to insert into
* @param caret The caret to insert above
* @param col The column to indent to
*/
private void insertNewLineAbove(@NotNull Editor editor, @NotNull Caret caret, int col) {
if (editor.isOneLineMode()) return;
if (caret.getVisualPosition().line == 0) {
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretToLineStart(editor, caret));
CaretData.setWasInFirstLine(caret, true);
}
else {
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretVertical(editor, caret, -1));
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretToLineEnd(editor, caret));
}
EditorData.setChangeSwitchMode(editor, CommandState.Mode.INSERT);
insertText(editor, caret, "\n" + StringUtil.repeat(" ", col));
if (CaretData.wasInFirstLine(caret)) {
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretVertical(editor, caret, -1));
CaretData.setWasInFirstLine(caret, false);
}
}
代码示例来源:origin: JetBrains/ideavim
/**
* Begin insert before the current line by creating a new blank line above the current line
* for all carets
*
* @param editor The editor to insert into
*/
public void insertNewLineAbove(@NotNull final Editor editor, @NotNull DataContext context) {
if (editor.isOneLineMode()) return;
for (Caret caret : editor.getCaretModel().getAllCarets()) {
if (caret.getVisualPosition().line == 0) {
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretToLineStart(editor, caret));
CaretData.setWasInFirstLine(caret, true);
}
else {
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretVertical(editor, caret, -1));
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretToLineEnd(editor, caret));
}
}
initInsert(editor, context, CommandState.Mode.INSERT);
runEnterAction(editor, context);
for (Caret caret : editor.getCaretModel().getAllCarets()) {
if (CaretData.wasInFirstLine(caret)) {
CaretData.setWasInFirstLine(caret, false);
MotionGroup.moveCaret(editor, caret, VimPlugin.getMotion().moveCaretVertical(editor, caret, -1));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!