IDEA-15815 Ctrl+c combination behavior

1. The 'skip auto select line' behavior is expanded to 'cut' processing;
2. The controlling property is renamed;
This commit is contained in:
Denis.Zhdanov
2013-03-18 17:28:32 +04:00
parent 589615a675
commit abcfb1d7ba
5 changed files with 14 additions and 6 deletions
@@ -66,7 +66,7 @@ public class CopyHandler extends EditorActionHandler {
final SelectionModel selectionModel = editor.getSelectionModel();
if(!selectionModel.hasSelection() && !selectionModel.hasBlockSelection()) {
if (Registry.is(CopyAction.SKIP_COPY_FOR_EMPTY_SELECTION_KEY)) {
if (Registry.is(CopyAction.SKIP_COPY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
return;
}
selectionModel.selectLineAtCaret();
@@ -23,11 +23,12 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorModificationUtil;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.editor.VisualPosition;
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler;
import com.intellij.openapi.editor.actions.CopyAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
@@ -59,6 +60,9 @@ public class CutHandler extends EditorWriteActionHandler {
SelectionModel selectionModel = editor.getSelectionModel();
if (!selectionModel.hasSelection() && !selectionModel.hasBlockSelection()) {
if (Registry.is(CopyAction.SKIP_COPY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
return;
}
selectionModel.selectLineAtCaret();
if (!selectionModel.hasSelection()) return;
}
@@ -32,8 +32,8 @@ import com.intellij.openapi.util.registry.Registry;
public class CopyAction extends EditorAction {
public static final String SKIP_COPY_FOR_EMPTY_SELECTION_KEY = "editor.skip.copy.for.empty.selection";
public static final String SKIP_COPY_AND_CUT_FOR_EMPTY_SELECTION_KEY = "editor.skip.copy.and.cut.for.empty.selection";
public CopyAction() {
super(new Handler());
}
@@ -42,7 +42,7 @@ public class CopyAction extends EditorAction {
@Override
public void execute(Editor editor, DataContext dataContext) {
if (!editor.getSelectionModel().hasSelection() && !editor.getSelectionModel().hasBlockSelection()) {
if (Registry.is(SKIP_COPY_FOR_EMPTY_SELECTION_KEY)) {
if (Registry.is(SKIP_COPY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
return;
}
editor.getSelectionModel().selectLineAtCaret();
@@ -29,6 +29,7 @@ import com.intellij.openapi.editor.EditorModificationUtil;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.util.registry.Registry;
public class CutAction extends EditorAction {
public CutAction() {
@@ -39,6 +40,9 @@ public class CutAction extends EditorAction {
@Override
public void executeWriteAction(Editor editor, DataContext dataContext) {
if(!editor.getSelectionModel().hasSelection()) {
if (Registry.is(CopyAction.SKIP_COPY_AND_CUT_FOR_EMPTY_SELECTION_KEY)) {
return;
}
editor.getSelectionModel().selectLineAtCaret();
}
editor.getSelectionModel().copySelectionToClipboard();
@@ -103,7 +103,7 @@ editor.mouseSelectionStateResetTimeout=1000
editor.mouseSelectionStateResetDeadZone=4
editor.use.new.tabs=true
editor.smarterSelectionQuoting=true
editor.skip.copy.for.empty.selection=false
editor.skip.copy.and.cut.for.empty.selection=false
ide.showIndexRebuildMessage=false