fixed PY-14284 IPython Notebook: shortcuts scope should depend on the focus for non-code cells

This commit is contained in:
Ekaterina Tuzova
2014-11-06 14:26:18 +03:00
parent dbc92eb269
commit 94fe193eb9
2 changed files with 21 additions and 4 deletions
+4 -4
View File
@@ -45,10 +45,10 @@
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbAddCellAboveAction" id="IpnbAddCellAboveAction" text="Insert Cell Above">
<keyboard-shortcut keymap="$default" first-keystroke="ctrl shift EQUALS"/>
</action>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbCutCellAction" id="IpnbCutCellAction" text="Cut Cell" use-shortcut-of="$Cut"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbCopyCellAction" id="IpnbCopyCellAction" text="Copy Cell" use-shortcut-of="$Copy"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbPasteCellAction" id="IpnbPasteCellAction" text="Paste Cell Below" use-shortcut-of="$Paste"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbDeleteCellAction" id="IpnbDeleteCellAction" text="Delete Cell" use-shortcut-of="$Delete"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbCutCellAction" id="IpnbCutCellAction" text="Cut Cell"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbCopyCellAction" id="IpnbCopyCellAction" text="Copy Cell"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbPasteCellAction" id="IpnbPasteCellAction" text="Paste Cell Below"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbDeleteCellAction" id="IpnbDeleteCellAction" text="Delete Cell"/>
<action class="org.jetbrains.plugins.ipnb.editor.actions.IpnbMoveCellDownAction" id="IpnbMoveCellDownAction" text="Move Cell Down">
<keyboard-shortcut keymap="$default" first-keystroke="ctrl shift DOWN"/>
@@ -22,6 +22,7 @@ import org.jetbrains.plugins.ipnb.format.cells.output.IpnbOutputCell;
import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@@ -285,6 +286,22 @@ public class IpnbFilePanel extends JPanel implements Scrollable, DataProvider {
}
}
}
else if (e.getKeyCode() == KeyEvent.VK_DELETE) {
if (!mySelectedCell.isEditing())
deleteCell(mySelectedCell);
}
else if (e.getKeyCode() == KeyEvent.VK_X && e.getModifiers() == InputEvent.CTRL_MASK) {
if (!mySelectedCell.isEditing())
cutCell();
}
else if (e.getKeyCode() == KeyEvent.VK_C && e.getModifiers() == InputEvent.CTRL_MASK) {
if (!mySelectedCell.isEditing())
copyCell();
}
else if (e.getKeyCode() == KeyEvent.VK_V && e.getModifiers() == InputEvent.CTRL_MASK) {
if (!mySelectedCell.isEditing())
pasteCell();
}
else {
getParent().dispatchEvent(e);
}