Merge branch 'master' of http://github.com/ajaxorg/editor into HEAD
This commit is contained in:
commit
9a8bb6cbf3
4 changed files with 26 additions and 8 deletions
|
|
@ -249,10 +249,21 @@ var Document = function(text, mode) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a verbatim copy of the given line as it is in the document
|
||||
*/
|
||||
this.getLine = function(row) {
|
||||
return this.lines[row] || "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a line as it is displayed on screen. Tabs are replaced by spaces.
|
||||
*/
|
||||
this.getDisplayLine = function(row) {
|
||||
var tab = new Array(this.getTabSize()+1).join(" ");
|
||||
return this.lines[row].replace(/\t/g, tab);
|
||||
};
|
||||
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
return this.lines.slice(firstRow, lastRow+1);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -281,7 +281,14 @@ var Selection = function(doc) {
|
|||
};
|
||||
|
||||
this.moveCursorLineStart = function() {
|
||||
this.moveCursorTo(this.selectionLead.row, 0);
|
||||
var row = this.selectionLead.row;
|
||||
var column = this.selectionLead.column;
|
||||
var beforeCursor = this.doc.getDisplayLine(row).slice(0, column);
|
||||
var leadingSpace = beforeCursor.match(/^\s+/);
|
||||
if (!leadingSpace || leadingSpace[0].length >= column)
|
||||
this.moveCursorTo(this.selectionLead.row, 0);
|
||||
else
|
||||
this.moveCursorTo(this.selectionLead.row, leadingSpace[0].length);
|
||||
};
|
||||
|
||||
this.moveCursorLineEnd = function() {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ JavaScriptHighlightRules = function() {
|
|||
var docComment = new DocCommentHighlightRules();
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
("break|case|catch|continue|default|delete|do|else|finally|for|function|\
|
||||
if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with").split("|")
|
||||
("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
||||
"if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
|
|
@ -28,8 +28,8 @@ JavaScriptHighlightRules = function() {
|
|||
);
|
||||
|
||||
var futureReserved = lang.arrayToMap(
|
||||
("class|enum|extends|super|const|export|import|implements|let|private|\
|
||||
public|yield|interface|package|protected|static").split("|")
|
||||
("class|enum|extends|super|const|export|import|implements|let|private|" +
|
||||
"public|yield|interface|package|protected|static").split("|")
|
||||
);
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.ace-tm .ace_editor {
|
||||
border: 2px solid rgb(159, 159, 159);
|
||||
font-family: "Menlo", "Monaco", "Courier New", "Courier", monospace;
|
||||
font-size: 12px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.ace-tm .ace_editor.ace_focus {
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
width: 50px;
|
||||
background: #e8e8e8;
|
||||
color: #333;
|
||||
font-family: Menlo, Monaco, "Courier New";
|
||||
font-size: 12px;
|
||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
||||
font-size: 11px;
|
||||
overflow : hidden;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue