package
This commit is contained in:
parent
cbd29bc541
commit
d386d4c6a1
125 changed files with 3861 additions and 3761 deletions
|
|
@ -1165,7 +1165,7 @@ var PhpHighlightRules = function() {
|
|||
}, {
|
||||
token : "string",
|
||||
regex : '[^"]+'
|
||||
},
|
||||
}
|
||||
],
|
||||
"qstring" : [
|
||||
{
|
||||
|
|
@ -1213,7 +1213,7 @@ var PhpHighlightRules = function() {
|
|||
next : "htmltag"
|
||||
}, {
|
||||
token : "meta.tag",
|
||||
regex : ">",
|
||||
regex : ">"
|
||||
}, {
|
||||
token : 'text',
|
||||
regex : "(?:media|type|href)"
|
||||
|
|
@ -1223,7 +1223,7 @@ var PhpHighlightRules = function() {
|
|||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "\{",
|
||||
next : "cssdeclaration",
|
||||
next : "cssdeclaration"
|
||||
}, {
|
||||
token : "keyword",
|
||||
regex : "#[A-Za-z0-9\-\_\.]+"
|
||||
|
|
@ -1265,7 +1265,7 @@ var PhpHighlightRules = function() {
|
|||
regex : ";",
|
||||
next : "cssdeclaration"
|
||||
}
|
||||
],
|
||||
]
|
||||
};
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||
|
|
@ -1507,12 +1507,12 @@ var CstyleBehaviour = function () {
|
|||
return {
|
||||
text: '{' + selected + '}',
|
||||
selection: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
text: '{}',
|
||||
selection: [1, 1]
|
||||
}
|
||||
};
|
||||
}
|
||||
} else if (text == '}') {
|
||||
var cursor = editor.getCursorPosition();
|
||||
|
|
@ -1524,7 +1524,7 @@ var CstyleBehaviour = function () {
|
|||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} else if (text == "\n") {
|
||||
|
|
@ -1542,7 +1542,7 @@ var CstyleBehaviour = function () {
|
|||
return {
|
||||
text: '\n' + indent + '\n' + next_indent,
|
||||
selection: [1, indent.length, 1, indent.length]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1567,12 +1567,12 @@ var CstyleBehaviour = function () {
|
|||
return {
|
||||
text: '(' + selected + ')',
|
||||
selection: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
text: '()',
|
||||
selection: [1, 1]
|
||||
}
|
||||
};
|
||||
}
|
||||
} else if (text == ')') {
|
||||
var cursor = editor.getCursorPosition();
|
||||
|
|
@ -1584,7 +1584,7 @@ var CstyleBehaviour = function () {
|
|||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1603,14 +1603,15 @@ var CstyleBehaviour = function () {
|
|||
});
|
||||
|
||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||
if (text == '"') {
|
||||
if (text == '"' || text == "'") {
|
||||
var quote = text;
|
||||
var selection = editor.getSelectionRange();
|
||||
var selected = session.doc.getTextRange(selection);
|
||||
if (selected !== "") {
|
||||
return {
|
||||
text: '"' + selected + '"',
|
||||
text: quote + selected + quote,
|
||||
selection: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = session.doc.getLine(cursor.row);
|
||||
|
|
@ -1631,7 +1632,7 @@ var CstyleBehaviour = function () {
|
|||
if (token.type == "string") {
|
||||
quotepos = -1;
|
||||
} else if (quotepos < 0) {
|
||||
quotepos = token.value.indexOf('"');
|
||||
quotepos = token.value.indexOf(quote);
|
||||
}
|
||||
if ((token.value.length + col) > selection.start.column) {
|
||||
break;
|
||||
|
|
@ -1640,19 +1641,19 @@ var CstyleBehaviour = function () {
|
|||
}
|
||||
|
||||
// Try and be smart about when we auto insert.
|
||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||
return {
|
||||
text: '""',
|
||||
text: quote + quote,
|
||||
selection: [1,1]
|
||||
}
|
||||
};
|
||||
} else if (token && token.type === "string") {
|
||||
// Ignore input and move right one if we're typing over the closing quote.
|
||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||
if (rightChar == '"') {
|
||||
if (rightChar == quote) {
|
||||
return {
|
||||
text: '',
|
||||
selection: [1, 1]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1661,7 +1662,7 @@ var CstyleBehaviour = function () {
|
|||
|
||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||
var selected = session.doc.getTextRange(range);
|
||||
if (!range.isMultiLine() && selected == '"') {
|
||||
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||
var line = session.doc.getLine(range.start.row);
|
||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||
if (rightChar == '"') {
|
||||
|
|
@ -1671,7 +1672,8 @@ var CstyleBehaviour = function () {
|
|||
}
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
oop.inherits(CstyleBehaviour, Behaviour);
|
||||
|
||||
exports.CstyleBehaviour = CstyleBehaviour;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue