commit
12ef5f9f6b
11 changed files with 133 additions and 57 deletions
|
|
@ -80,6 +80,11 @@ exports.defaultCommands = [{
|
|||
name: "alignCursors",
|
||||
exec: function(editor) { editor.alignCursors(); },
|
||||
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
|
||||
}, {
|
||||
name: "findAll",
|
||||
exec: function(editor) { editor.findAll(); },
|
||||
bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
|
||||
readonly: true
|
||||
}];
|
||||
|
||||
// commands active only in multiselect mode
|
||||
|
|
|
|||
|
|
@ -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"};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
|
@ -164,6 +166,7 @@ var actions = exports.actions = {
|
|||
fn: function(editor, range, count, param) {
|
||||
var options = editor.getLastSearchOptions();
|
||||
options.backwards = false;
|
||||
options.start = null;
|
||||
|
||||
editor.selection.moveCursorRight();
|
||||
editor.selection.clearSelection();
|
||||
|
|
@ -180,6 +183,7 @@ var actions = exports.actions = {
|
|||
fn: function(editor, range, count, param) {
|
||||
var options = editor.getLastSearchOptions();
|
||||
options.backwards = true;
|
||||
options.start = null;
|
||||
|
||||
editor.findPrevious(options);
|
||||
ensureScrollMargin(editor);
|
||||
|
|
@ -340,6 +344,7 @@ var inputBuffer = exports.inputBuffer = {
|
|||
currentCmd: null,
|
||||
//currentMode: 0,
|
||||
currentCount: "",
|
||||
pendingCount: "",
|
||||
status: "",
|
||||
|
||||
// Types
|
||||
|
|
@ -440,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);
|
||||
},
|
||||
|
||||
|
|
@ -497,7 +503,8 @@ var inputBuffer = exports.inputBuffer = {
|
|||
else if (selectable) {
|
||||
repeat(function() {
|
||||
run(motionObj.sel);
|
||||
operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
|
||||
operators[o.ch].fn(editor, editor.getSelectionRange(),
|
||||
o.count, motionObj.param ? motionObj : param);
|
||||
}, o.count || 1);
|
||||
}
|
||||
this.reset();
|
||||
|
|
@ -517,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;
|
||||
|
|
|
|||
|
|
@ -350,6 +350,10 @@ module.exports = {
|
|||
case "W":
|
||||
editor.selection.selectAWord();
|
||||
break;
|
||||
case ")":
|
||||
case "}":
|
||||
case "]":
|
||||
param = editor.session.$brackets[param];
|
||||
case "(":
|
||||
case "{":
|
||||
case "[":
|
||||
|
|
@ -383,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();
|
||||
|
|
@ -398,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();
|
||||
|
|
@ -413,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();
|
||||
|
|
@ -431,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();
|
||||
|
|
@ -656,7 +664,8 @@ module.exports = {
|
|||
pos.column = line.length;
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
},
|
||||
isLine: true
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ module.exports = {
|
|||
},
|
||||
fn: function(editor, range, count, param) {
|
||||
count = count || 1;
|
||||
if (param && param.isLine)
|
||||
param = "y";
|
||||
switch (param) {
|
||||
case "y":
|
||||
var pos = editor.getCursorPosition();
|
||||
|
|
|
|||
|
|
@ -133,6 +133,15 @@ var Keys = (function() {
|
|||
|
||||
// workaround for firefox bug
|
||||
ret[173] = '-';
|
||||
|
||||
(function() {
|
||||
var mods = ["cmd", "ctrl", "alt", "shift"];
|
||||
for (var i = Math.pow(2, mods.length); i--;) {
|
||||
ret.KEY_MODS[i] = mods.filter(function(x) {
|
||||
return i & ret.KEY_MODS[x];
|
||||
}).join("-") + "-";
|
||||
}
|
||||
})();
|
||||
|
||||
(function() {
|
||||
var mods = ["cmd", "ctrl", "alt", "shift"];
|
||||
|
|
|
|||
|
|
@ -176,9 +176,12 @@ var JavaScriptHighlightRules = function() {
|
|||
}, {
|
||||
token : ["punctuation.operator", "support.constant"],
|
||||
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||
}, {
|
||||
token : ["support.constant"],
|
||||
regex : /that\b/
|
||||
}, {
|
||||
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||
regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : identifierRe
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ var TextMode = require("./text").Mode;
|
|||
var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.HighlightRules = ShHighlightRules;
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ var ShHighlightRules = function() {
|
|||
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||
var fileDescriptor = "(?:&" + intPart + ")";
|
||||
|
||||
var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
|
||||
var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
|
||||
var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
|
||||
|
||||
var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
|
||||
|
|
|
|||
|
|
@ -578,8 +578,14 @@ var Editor = require("./editor").Editor;
|
|||
this.findAll = function(needle, options, additive) {
|
||||
options = options || {};
|
||||
options.needle = needle || options.needle;
|
||||
if (options.needle == undefined) {
|
||||
var range = this.selection.isEmpty()
|
||||
? this.selection.getWordRange()
|
||||
: this.selection.getRange();
|
||||
options.needle = this.session.getTextRange(range);
|
||||
}
|
||||
this.$search.set(options);
|
||||
|
||||
|
||||
var ranges = this.$search.findAll(this.session);
|
||||
if (!ranges.length)
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue