setDefaultHandler was breaking vim mode
This commit is contained in:
parent
9910c9db32
commit
739baebbd0
3 changed files with 7 additions and 7 deletions
|
|
@ -36,7 +36,7 @@ var event = require("../lib/event");
|
|||
|
||||
var KeyBinding = function(editor) {
|
||||
this.$editor = editor;
|
||||
this.$data = {};
|
||||
this.$data = {editor: editor};
|
||||
this.$handlers = [];
|
||||
this.setDefaultHandler(editor.commands);
|
||||
};
|
||||
|
|
@ -46,7 +46,6 @@ var KeyBinding = function(editor) {
|
|||
this.removeKeyboardHandler(this.$defaultHandler);
|
||||
this.$defaultHandler = kb;
|
||||
this.addKeyboardHandler(kb, 0);
|
||||
this.$data = {editor: this.$editor};
|
||||
};
|
||||
|
||||
this.setKeyboardHandler = function(kb) {
|
||||
|
|
|
|||
|
|
@ -120,23 +120,24 @@ exports.handler = {
|
|||
return null;
|
||||
|
||||
var editor = data.editor;
|
||||
var vimState = data.vimState || "start";
|
||||
|
||||
if (hashId == 1)
|
||||
key = "ctrl-" + key;
|
||||
if (key == "ctrl-c") {
|
||||
if (!useragent.isMac && editor.getCopyText()) {
|
||||
editor.once("copy", function() {
|
||||
if (data.state == "start")
|
||||
if (vimState == "start")
|
||||
coreCommands.stop.exec(editor);
|
||||
else
|
||||
editor.selection.clearSelection();
|
||||
});
|
||||
return {command: "null", passEvent: true};
|
||||
}
|
||||
return {command: coreCommands.stop};
|
||||
return {command: coreCommands.stop};
|
||||
} else if ((key == "esc" && hashId === 0) || key == "ctrl-[") {
|
||||
return {command: coreCommands.stop};
|
||||
} else if (data.state == "start") {
|
||||
} else if (vimState == "start") {
|
||||
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
|
||||
hashId = -1;
|
||||
key = data.inputChar;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ module.exports = {
|
|||
|
||||
editor.setOverwrite(false);
|
||||
editor.keyBinding.$data.buffer = "";
|
||||
editor.keyBinding.$data.state = "insertMode";
|
||||
editor.keyBinding.$data.vimState = "insertMode";
|
||||
this.onVisualMode = false;
|
||||
this.onVisualLineMode = false;
|
||||
if(this.onInsertReplaySequence) {
|
||||
|
|
@ -66,7 +66,7 @@ module.exports = {
|
|||
|
||||
editor.setOverwrite(true);
|
||||
editor.keyBinding.$data.buffer = "";
|
||||
editor.keyBinding.$data.state = "start";
|
||||
editor.keyBinding.$data.vimState = "start";
|
||||
this.onVisualMode = false;
|
||||
this.onVisualLineMode = false;
|
||||
editor._emit("changeStatus");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue