fix more vim issues (fixes #1930)

This commit is contained in:
nightwing 2014-04-29 14:12:08 +04:00
commit 0155c67b1f
4 changed files with 19 additions and 8 deletions

View file

@ -149,12 +149,13 @@ exports.handler = {
if (!isHandled && hashId !== -1)
return;
return {command: "null", passEvent: !isHandled};
} // if no modifier || shift: wait for input.
else if (key.length == 1 && (hashId === 0 || hashId == 4)) {
return {command: "null", passEvent: true};
} else if (key == "esc" && hashId === 0) {
return {command: coreCommands.stop};
}
// if no modifier || shift: wait for input.
else if (hashId === 0 || hashId == 4) {
return {command: "null", passEvent: true};
}
} else {
if (key == "ctrl-w") {
return {command: "removewordleft"};

View file

@ -123,10 +123,12 @@ var actions = exports.actions = {
range.end.column++;
var text = editor.session.getTextRange(range);
var toggled = text.toUpperCase();
if (toggled == text)
editor.navigateRight();
else
if (toggled != text)
editor.session.replace(range, toggled);
else if (text.toLowerCase() != text)
editor.session.replace(range, text.toLowerCase())
else
editor.navigateRight();
}, count || 1);
}
},
@ -342,6 +344,7 @@ var inputBuffer = exports.inputBuffer = {
currentCmd: null,
//currentMode: 0,
currentCount: "",
pendingCount: "",
status: "",
// Types
@ -442,8 +445,9 @@ var inputBuffer = exports.inputBuffer = {
},
getCount: function() {
var count = this.currentCount;
var count = this.currentCount || this.pendingCount;
this.currentCount = "";
this.pendingCount = count;
return count && parseInt(count, 10);
},
@ -520,6 +524,7 @@ var inputBuffer = exports.inputBuffer = {
this.operator = null;
this.motion = null;
this.currentCount = "";
this.pendingCount = "";
this.status = "";
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
this.idle = true;

View file

@ -387,6 +387,7 @@ module.exports = {
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "f", param: param};
var cursor = editor.getCursorPosition();
@ -402,6 +403,7 @@ module.exports = {
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "F", param: param};
var cursor = editor.getCursorPosition();
@ -417,6 +419,7 @@ module.exports = {
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "t", param: param};
var cursor = editor.getCursorPosition();
@ -435,6 +438,7 @@ module.exports = {
param: true,
handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "T", param: param};
var cursor = editor.getCursorPosition();

View file

@ -115,8 +115,9 @@ module.exports = {
},
fn: function(editor, range, count, param) {
count = count || 1;
if (param && param.isLine)
param = "y";
switch (param) {
case param.isLine && param:
case "y":
var pos = editor.getCursorPosition();
editor.selection.selectLine();