Merge pull request #994 from ajaxorg/cleanup

Cleanup
This commit is contained in:
Mostafa Eweda 2012-10-12 16:09:48 -07:00
commit 34b2e292c7
25 changed files with 83 additions and 83 deletions

2
build

@ -1 +1 @@
Subproject commit c2f3abb2ecd3287f90225d804132f0fd26cfb639
Subproject commit 6149ca6b148e878d4c1341d4675ca3597d78dbdd

View file

@ -683,6 +683,7 @@ function Folding() {
};
this.onFoldWidgetClick = function(row, e) {
e = e.domEvent;
var type = this.getFoldWidget(row);
var line = this.getLine(row);
var onlySubfolds = e.shiftKey;

View file

@ -304,76 +304,76 @@ var inputBuffer = exports.inputBuffer = {
lastInsertCommands: [],
push: function(editor, char, keyId) {
push: function(editor, ch, keyId) {
this.idle = false;
var wObj = this.waitingForParam;
if (wObj) {
this.exec(editor, wObj, char);
this.exec(editor, wObj, ch);
}
// If input is a number (that doesn't start with 0)
else if (!(char === "0" && !this.currentCount.length) &&
(char.match(/^\d+$/) && this.isAccepting(NUMBER))) {
// Assuming that char is always of type String, and not Number
this.currentCount += char;
else if (!(ch === "0" && !this.currentCount.length) &&
(ch.match(/^\d+$/) && this.isAccepting(NUMBER))) {
// Assuming that ch is always of type String, and not Number
this.currentCount += ch;
this.currentCmd = NUMBER;
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
}
else if (!this.operator && this.isAccepting(OPERATOR) && operators[char]) {
else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
this.operator = {
char: char,
ch: ch,
count: this.getCount()
};
this.currentCmd = OPERATOR;
this.accepting = [NUMBER, MOTION, ACTION];
this.exec(editor, { operator: this.operator });
}
else if (motions[char] && this.isAccepting(MOTION)) {
else if (motions[ch] && this.isAccepting(MOTION)) {
this.currentCmd = MOTION;
var ctx = {
operator: this.operator,
motion: {
char: char,
ch: ch,
count: this.getCount()
}
};
if (motions[char].param)
if (motions[ch].param)
this.waitForParam(ctx);
else
this.exec(editor, ctx);
}
else if (alias[char] && this.isAccepting(MOTION)) {
alias[char].operator.count = this.getCount();
this.exec(editor, alias[char]);
else if (alias[ch] && this.isAccepting(MOTION)) {
alias[ch].operator.count = this.getCount();
this.exec(editor, alias[ch]);
}
else if (actions[char] && this.isAccepting(ACTION)) {
else if (actions[ch] && this.isAccepting(ACTION)) {
var actionObj = {
action: {
fn: actions[char].fn,
fn: actions[ch].fn,
count: this.getCount()
}
};
if (actions[char].param) {
if (actions[ch].param) {
this.waitForParam(actionObj);
}
else {
this.exec(editor, actionObj);
}
if (actions[char].acceptsMotion)
if (actions[ch].acceptsMotion)
this.idle = false;
}
else if (this.operator) {
this.exec(editor, { operator: this.operator }, char);
this.exec(editor, { operator: this.operator }, ch);
}
else {
this.reset();
}
if (this.waitingForParam || this.motion || this.operator) {
this.status += char;
this.status += ch;
} else if (this.currentCount) {
this.status = this.currentCount;
} else if (this.status) {
@ -410,18 +410,18 @@ var inputBuffer = exports.inputBuffer = {
}
if (o && !editor.selection.isEmpty()) {
if (operators[o.char].selFn) {
operators[o.char].selFn(editor, editor.getSelectionRange(), o.count, param);
if (operators[o.ch].selFn) {
operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
this.reset();
}
return;
}
// There is an operator, but no motion or action. We try to pass the
// current char to the operator to see if it responds to it (an example
// current ch to the operator to see if it responds to it (an example
// of this is the 'dd' operator).
else if (!m && !a && o && param) {
operators[o.char].fn(editor, null, o.count, param);
operators[o.ch].fn(editor, null, o.count, param);
this.reset();
}
else if (m) {
@ -434,7 +434,7 @@ var inputBuffer = exports.inputBuffer = {
}
};
var motionObj = motions[m.char];
var motionObj = motions[m.ch];
var selectable = motionObj.sel;
if (!o) {
@ -446,7 +446,7 @@ var inputBuffer = exports.inputBuffer = {
else if (selectable) {
repeat(function() {
run(motionObj.sel);
operators[o.char].fn(editor, editor.getSelectionRange(), o.count, param);
operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
}, o.count || 1);
}
this.reset();

View file

@ -34,57 +34,57 @@ define(function(require, exports, module) {
module.exports = {
"x": {
operator: {
char: "d",
ch: "d",
count: 1
},
motion: {
char: "l",
ch: "l",
count: 1
}
},
"X": {
operator: {
char: "d",
ch: "d",
count: 1
},
motion: {
char: "h",
ch: "h",
count: 1
}
},
"D": {
operator: {
char: "d",
ch: "d",
count: 1
},
motion: {
char: "$",
ch: "$",
count: 1
}
},
"C": {
operator: {
char: "c",
ch: "c",
count: 1
},
motion: {
char: "$",
ch: "$",
count: 1
}
},
"s": {
operator: {
char: "c",
ch: "c",
count: 1
},
motion: {
char: "l",
ch: "l",
count: 1
}
},
"S": {
operator: {
char: "c",
ch: "c",
count: 1
},
param: "c"

View file

@ -580,7 +580,7 @@ module.exports = {
sel: function(editor, range, count, param) {
keepScrollPosition(editor, editor.selectPageUp);
}
},
}
};
module.exports.backspace = module.exports.left = module.exports.h;

View file

@ -99,24 +99,24 @@ module.exports = {
this.onVisualLineMode = false;
}
},
getRightNthChar: function(editor, cursor, char, n) {
getRightNthChar: function(editor, cursor, ch, n) {
var line = editor.getSession().getLine(cursor.row);
var matches = line.substr(cursor.column + 1).split(char);
var matches = line.substr(cursor.column + 1).split(ch);
return n < matches.length ? matches.slice(0, n).join(char).length : null;
return n < matches.length ? matches.slice(0, n).join(ch).length : null;
},
getLeftNthChar: function(editor, cursor, char, n) {
getLeftNthChar: function(editor, cursor, ch, n) {
var line = editor.getSession().getLine(cursor.row);
var matches = line.substr(0, cursor.column).split(char);
var matches = line.substr(0, cursor.column).split(ch);
return n < matches.length ? matches.slice(-1 * n).join(char).length : null;
return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
},
toRealChar: function(char) {
if (char.length === 1)
return char;
toRealChar: function(ch) {
if (ch.length === 1)
return ch;
if (/^shift-./.test(char))
return char[char.length - 1].toUpperCase();
if (/^shift-./.test(ch))
return ch[ch.length - 1].toUpperCase();
else
return "";
},

View file

@ -58,11 +58,11 @@ var ColdfusionHighlightRules = function() {
next : "comment"
}, {
token : "meta.tag",
regex : "<(?=\s*script)",
regex : "<(?=script)",
next : "script"
}, {
token : "meta.tag",
regex : "<(?=\s*style)",
regex : "<(?=style)",
next : "style"
}, {
token : "meta.tag", // opening tag

View file

@ -74,14 +74,14 @@ var DiffHighlightRules = function() {
"support.constant",
"text",
"invalid"
],
]
}, { // removed
"regex": "^([<\\-])(.*?)(\\s*)$",
"token": [
"support.function",
"string",
"invalid"
],
]
}, {
"regex": "^(diff)(\\s+--\\w+)?(.+?)( .+)?$",
"token": ["variable", "variable", "keyword", "variable"]

View file

@ -47,7 +47,7 @@ module.exports = {
']',
'[ ',
'{ ',
'[ #-',
'[ #-'
]);
var mode = new PythonMode();

View file

@ -80,11 +80,11 @@ var HtmlHighlightRules = function() {
regex : "<\\!.*?>"
}, {
token : "meta.tag",
regex : "<(?=\s*script\\b)",
regex : "<(?=script\\b)",
next : "script"
}, {
token : "meta.tag",
regex : "<(?=\s*style\\b)",
regex : "<(?=style\\b)",
next : "style"
}, {
token : "meta.tag", // opening tag

View file

@ -82,7 +82,7 @@ var JadeHighlightRules = function() {
},
{
"token" : "punctuation.section.comment",
"regex" : "^\\s*\/\/(?:\\s*[^-\\s]|\\s+\\S)(?:.*$)",
"regex" : "^\\s*\/\/(?:\\s*[^-\\s]|\\s+\\S)(?:.*$)"
},
{
"token" : function(space, text) {

View file

@ -55,8 +55,7 @@ var JavaHighlightRules = function() {
"variable.language": "this",
"keyword": keywords,
"constant.language": buildinConstants,
"support.function": langClasses,
"support.function": langClasses
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.

View file

@ -286,7 +286,7 @@ var JavaScriptHighlightRules = function() {
merge: true
}, {
token: "constant.language.escape",
regex: "-",
regex: "-"
}, {
token: "string.regexp.charachterclass",
regex: /[^\]\-\\]+/,

View file

@ -9,7 +9,7 @@ var LatexHighlightRules = function() {
"start" : [{
// A tex command e.g. \foo
token : "keyword",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)",
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
}, {
// Curly and square braces
token : "lparen",

View file

@ -51,7 +51,7 @@ oop.inherits(Mode, TextMode);
"elseif": 1,
"repeat": 1,
"end": -1,
"until": -1,
"until": -1
};
var outdentKeywords = [
"else",

View file

@ -404,7 +404,7 @@ var PgsqlHighlightRules = function() {
var keywordMapper = this.createKeywordMapper({
"support.function": builtinFunctions,
"keyword": keywords,
"keyword": keywords
}, "identifier", true);

View file

@ -122,11 +122,11 @@ var RubyHighlightRules = function() {
token : "text", // namespaces aren't symbols
regex : "::"
}, {
token : "variable.instancce", // instance variable
regex : "@{1,2}(?:[a-zA-Z_]|\d)+"
token : "variable.instance", // instance variable
regex : "@{1,2}[a-zA-Z_\\d]+"
}, {
token : "variable.class", // class name
regex : "[A-Z](?:[a-zA-Z_]|\d)+"
regex : "[A-Z][a-zA-Z_\\d]+"
}, {
token : "string", // symbol
regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"

View file

@ -40,7 +40,7 @@ var scadHighlightRules = function() {
var keywordMapper = this.createKeywordMapper({
"variable.language": "this",
"keyword": "module|if|else|for",
"constant.language": "NULL",
"constant.language": "NULL"
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.

View file

@ -126,7 +126,7 @@ var ScalaHighlightRules = function() {
"string" : [
{
token : "escape",
regex : '\\\\"',
regex : '\\\\"'
}, {
token : "string",
merge : true,

View file

@ -92,7 +92,7 @@ var ShHighlightRules = function() {
regex : variable
}, {
token : "support.function",
regex : func,
regex : func
}, {
token : "support.function",
regex : fileDescriptor

View file

@ -41,7 +41,7 @@ var SvgHighlightRules = function() {
this.$rules.start.splice(3, 0, {
token : "meta.tag",
regex : "<(?=\s*script)",
regex : "<(?=script)",
next : "script"
});

View file

@ -150,16 +150,16 @@ var TclHighlightRules = function() {
}],
"variable" : [
{
token : "variable.instancce", // variable xotcl with braces
regex : "(?:[:][:])?(?:[a-zA-Z_]|\d)+(?:(?:[:][:])?(?:[a-zA-Z_]|\d)+)?(?:[(](?:[a-zA-Z_]|\d)+[)])?",
token : "variable.instance", // variable xotcl with braces
regex : "(?:[:][:])?[a-zA-Z_\\d]+(?:(?:[:][:])?[a-zA-Z_\\d]+)?(?:[(][a-zA-Z_\\d]+[)])?",
next : "start"
}, {
token : "variable.instancce", // variable tcl
regex : "(?:[a-zA-Z_]|\d)+(?:[(](?:[a-zA-Z_]|\d)+[)])?",
token : "variable.instance", // variable tcl
regex : "[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?",
next : "start"
}, {
token : "variable.instancce", // variable tcl with braces
regex : "{?(?:[a-zA-Z_]|\d)+}?",
token : "variable.instance", // variable tcl with braces
regex : "{?[a-zA-Z_\\d]+}?",
next : "start"
}],
"qqstring" : [ {

View file

@ -43,7 +43,7 @@ module.exports = {
"test: configure the search object" : function() {
var search = new Search();
search.set({
needle: "juhu",
needle: "juhu"
});
},
@ -397,7 +397,7 @@ module.exports = {
var search = new Search().set({
needle: "[ ]+$",
regExp: true,
wrap: true,
wrap: true
});
session.getSelection().moveCursorTo(1, 2);
@ -414,7 +414,7 @@ module.exports = {
var search = new Search().set({
needle: "foo",
wrap: true,
wholeWord: true,
wholeWord: true
});
session.getSelection().moveCursorTo(0, 4);
@ -437,7 +437,7 @@ module.exports = {
needle: "foo",
wrap: true,
wholeWord: true,
backwards: true,
backwards: true
});
session.getSelection().moveCursorTo(0, 13);

View file

@ -202,7 +202,7 @@ module.exports = {
assert.equal(iterator.getCurrentToken().value, "for");
assert.equal(iterator.getCurrentTokenRow(), 1);
assert.equal(iterator.getCurrentTokenColumn(), 4);
},
}
};
});

View file

@ -103,7 +103,7 @@ var Tokenizer = function(rules, flag) {
var token = {
type: null,
value: "",
state: currentState,
state: currentState
};
initState();