1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-03-05 06:32:51 +01:00

Removed old block selection API usages to become compatible with IntelliJ branch 146

This commit is contained in:
Andrey Vlasovskikh 2016-04-22 03:22:02 +03:00
parent 17700a6537
commit dd0a7207d5
3 changed files with 1 additions and 39 deletions
src/com/maddyhome/idea/vim

View File

@ -38,7 +38,7 @@ public class VisualSwapEndsBlockAction extends VimCommandAction {
public VisualSwapEndsBlockAction() {
super(new EditorActionHandlerBase() {
protected boolean execute(@NotNull Editor editor, @NotNull DataContext context, @NotNull Command cmd) {
return VimPlugin.getMotion().swapVisualEndsBlock(editor);
return VimPlugin.getMotion().swapVisualEnds(editor);
}
});
}

View File

@ -20,7 +20,6 @@ package com.maddyhome.idea.vim.ex.handler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.util.text.StringUtil;
import com.maddyhome.idea.vim.VimPlugin;
@ -82,15 +81,6 @@ public class SortHandler extends CommandHandler {
return new LineRange(startLine, endLine);
}
// If we have a block selection
else if (selectionModel.hasBlockSelection()) {
final LogicalPosition blockStart = selectionModel.getBlockStart();
final LogicalPosition blockEnd = selectionModel.getBlockEnd();
if (blockStart != null && blockEnd != null) {
return new LineRange(blockStart.line, blockEnd.line);
}
}
// If we have a generic selection, i.e. "sort" entire document
else {
return new LineRange(0, editor.getDocument().getLineCount() - 1);

View File

@ -1698,34 +1698,6 @@ public class MotionGroup {
return true;
}
public boolean swapVisualEndsBlock(@NotNull Editor editor) {
if (CommandState.getInstance(editor).getSubMode() != CommandState.SubMode.VISUAL_BLOCK) {
return swapVisualEnds(editor);
}
LogicalPosition lineStart = editor.getSelectionModel().getBlockStart();
LogicalPosition lineEnd = editor.getSelectionModel().getBlockEnd();
if (lineStart == null || lineEnd == null) {
return false;
}
if (visualStart > visualEnd) {
LogicalPosition t = lineEnd;
lineEnd = lineStart;
lineStart = t;
}
LogicalPosition start = new LogicalPosition(lineStart.line, lineEnd.column);
LogicalPosition end = new LogicalPosition(lineEnd.line, lineStart.column);
visualStart = editor.logicalPositionToOffset(start);
visualEnd = editor.logicalPositionToOffset(end);
moveCaret(editor, visualEnd);
return true;
}
public void moveVisualStart(int startOffset) {
visualStart = startOffset;
}