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) {
|
var KeyBinding = function(editor) {
|
||||||
this.$editor = editor;
|
this.$editor = editor;
|
||||||
this.$data = {};
|
this.$data = {editor: editor};
|
||||||
this.$handlers = [];
|
this.$handlers = [];
|
||||||
this.setDefaultHandler(editor.commands);
|
this.setDefaultHandler(editor.commands);
|
||||||
};
|
};
|
||||||
|
|
@ -46,7 +46,6 @@ var KeyBinding = function(editor) {
|
||||||
this.removeKeyboardHandler(this.$defaultHandler);
|
this.removeKeyboardHandler(this.$defaultHandler);
|
||||||
this.$defaultHandler = kb;
|
this.$defaultHandler = kb;
|
||||||
this.addKeyboardHandler(kb, 0);
|
this.addKeyboardHandler(kb, 0);
|
||||||
this.$data = {editor: this.$editor};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setKeyboardHandler = function(kb) {
|
this.setKeyboardHandler = function(kb) {
|
||||||
|
|
|
||||||
|
|
@ -120,13 +120,14 @@ exports.handler = {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var editor = data.editor;
|
var editor = data.editor;
|
||||||
|
var vimState = data.vimState || "start";
|
||||||
|
|
||||||
if (hashId == 1)
|
if (hashId == 1)
|
||||||
key = "ctrl-" + key;
|
key = "ctrl-" + key;
|
||||||
if (key == "ctrl-c") {
|
if (key == "ctrl-c") {
|
||||||
if (!useragent.isMac && editor.getCopyText()) {
|
if (!useragent.isMac && editor.getCopyText()) {
|
||||||
editor.once("copy", function() {
|
editor.once("copy", function() {
|
||||||
if (data.state == "start")
|
if (vimState == "start")
|
||||||
coreCommands.stop.exec(editor);
|
coreCommands.stop.exec(editor);
|
||||||
else
|
else
|
||||||
editor.selection.clearSelection();
|
editor.selection.clearSelection();
|
||||||
|
|
@ -136,7 +137,7 @@ exports.handler = {
|
||||||
return {command: coreCommands.stop};
|
return {command: coreCommands.stop};
|
||||||
} else if ((key == "esc" && hashId === 0) || key == "ctrl-[") {
|
} else if ((key == "esc" && hashId === 0) || key == "ctrl-[") {
|
||||||
return {command: coreCommands.stop};
|
return {command: coreCommands.stop};
|
||||||
} else if (data.state == "start") {
|
} else if (vimState == "start") {
|
||||||
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
|
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
|
||||||
hashId = -1;
|
hashId = -1;
|
||||||
key = data.inputChar;
|
key = data.inputChar;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ module.exports = {
|
||||||
|
|
||||||
editor.setOverwrite(false);
|
editor.setOverwrite(false);
|
||||||
editor.keyBinding.$data.buffer = "";
|
editor.keyBinding.$data.buffer = "";
|
||||||
editor.keyBinding.$data.state = "insertMode";
|
editor.keyBinding.$data.vimState = "insertMode";
|
||||||
this.onVisualMode = false;
|
this.onVisualMode = false;
|
||||||
this.onVisualLineMode = false;
|
this.onVisualLineMode = false;
|
||||||
if(this.onInsertReplaySequence) {
|
if(this.onInsertReplaySequence) {
|
||||||
|
|
@ -66,7 +66,7 @@ module.exports = {
|
||||||
|
|
||||||
editor.setOverwrite(true);
|
editor.setOverwrite(true);
|
||||||
editor.keyBinding.$data.buffer = "";
|
editor.keyBinding.$data.buffer = "";
|
||||||
editor.keyBinding.$data.state = "start";
|
editor.keyBinding.$data.vimState = "start";
|
||||||
this.onVisualMode = false;
|
this.onVisualMode = false;
|
||||||
this.onVisualLineMode = false;
|
this.onVisualLineMode = false;
|
||||||
editor._emit("changeStatus");
|
editor._emit("changeStatus");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue