package ace
This commit is contained in:
parent
5a6eeab67d
commit
b05b476143
4 changed files with 142 additions and 70 deletions
|
|
@ -5169,7 +5169,8 @@ exports.setSelectionEnd = function(textarea, end) {
|
||||||
return textarea.selectionEnd = end;
|
return textarea.selectionEnd = end;
|
||||||
};
|
};
|
||||||
|
|
||||||
});/* ***** BEGIN LICENSE BLOCK *****
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
|
@ -5818,7 +5819,7 @@ var Editor =function(renderer, session) {
|
||||||
} else {
|
} else {
|
||||||
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||||
}
|
}
|
||||||
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "line");
|
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -5928,12 +5929,12 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
|
|
||||||
var start = cursor.column;
|
var start = cursor.column;
|
||||||
var lineState = session.getState(cursor.row);
|
var lineState = session.getState(cursor.row);
|
||||||
var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
|
var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
|
||||||
var line = session.getLine(cursor.row);
|
var line = session.getLine(cursor.row);
|
||||||
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
||||||
var end = session.insert(cursor, text);
|
var end = session.insert(cursor, text);
|
||||||
|
|
||||||
if (transform && transform.selection) {
|
if (transform && transform.selection) {
|
||||||
if (transform.selection.length == 2) { // Transform relative to the current column
|
if (transform.selection.length == 2) { // Transform relative to the current column
|
||||||
|
|
@ -9113,7 +9114,8 @@ var EditSession = function(text, mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getScreenLastRowColumn = function(screenRow) {
|
this.getScreenLastRowColumn = function(screenRow) {
|
||||||
return this.screenToDocumentColumn(screenRow, Number.MAX_VALUE / 10)
|
//return this.screenToDocumentColumn(screenRow, Number.MAX_VALUE / 10)
|
||||||
|
return this.documentToScreenColumn(screenRow, this.doc.getLine(screenRow).length);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDocumentLastRowColumn = function(docRow, docColumn) {
|
this.getDocumentLastRowColumn = function(docRow, docColumn) {
|
||||||
|
|
@ -9484,6 +9486,8 @@ var Selection = function(session) {
|
||||||
_self._dispatchEvent("changeCursor");
|
_self._dispatchEvent("changeCursor");
|
||||||
if (!_self.$isEmpty)
|
if (!_self.$isEmpty)
|
||||||
_self._dispatchEvent("changeSelection");
|
_self._dispatchEvent("changeSelection");
|
||||||
|
if (!_self.$preventUpdateDesiredColumnOnChange && e.old.column != e.value.column)
|
||||||
|
_self.$updateDesiredColumn();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.selectionAnchor.on("change", function() {
|
this.selectionAnchor.on("change", function() {
|
||||||
|
|
@ -9875,7 +9879,11 @@ var Selection = function(session) {
|
||||||
row = fold.start.row;
|
row = fold.start.row;
|
||||||
column = fold.start.column;
|
column = fold.start.column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$preventUpdateDesiredColumnOnChange = true;
|
||||||
this.selectionLead.setPosition(row, column);
|
this.selectionLead.setPosition(row, column);
|
||||||
|
this.$preventUpdateDesiredColumnOnChange = false;
|
||||||
|
|
||||||
if (!preventUpdateDesiredColumn)
|
if (!preventUpdateDesiredColumn)
|
||||||
this.$updateDesiredColumn(this.selectionLead.column);
|
this.$updateDesiredColumn(this.selectionLead.column);
|
||||||
};
|
};
|
||||||
|
|
@ -10183,6 +10191,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
session.documentToScreenPosition(this.start);
|
session.documentToScreenPosition(this.start);
|
||||||
var screenPosEnd =
|
var screenPosEnd =
|
||||||
session.documentToScreenPosition(this.end);
|
session.documentToScreenPosition(this.end);
|
||||||
|
|
||||||
return new Range(
|
return new Range(
|
||||||
screenPosStart.row, screenPosStart.column,
|
screenPosStart.row, screenPosStart.column,
|
||||||
screenPosEnd.row, screenPosEnd.column
|
screenPosEnd.row, screenPosEnd.column
|
||||||
|
|
@ -13855,7 +13864,6 @@ var Marker = function(parentEl) {
|
||||||
this.setPadding = function(padding) {
|
this.setPadding = function(padding) {
|
||||||
this.$padding = padding;
|
this.$padding = padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setSession = function(session) {
|
this.setSession = function(session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
};
|
};
|
||||||
|
|
@ -13871,6 +13879,7 @@ var Marker = function(parentEl) {
|
||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
|
|
||||||
var html = [];
|
var html = [];
|
||||||
for ( var key in this.markers) {
|
for ( var key in this.markers) {
|
||||||
var marker = this.markers[key];
|
var marker = this.markers[key];
|
||||||
|
|
@ -13879,23 +13888,28 @@ var Marker = function(parentEl) {
|
||||||
if (range.isEmpty()) continue;
|
if (range.isEmpty()) continue;
|
||||||
|
|
||||||
range = range.toScreenRange(this.session);
|
range = range.toScreenRange(this.session);
|
||||||
|
|
||||||
if (marker.renderer) {
|
if (marker.renderer) {
|
||||||
var top = this.$getTop(range.start.row, config);
|
var top = this.$getTop(range.start.row, config);
|
||||||
var left = Math.round(this.$padding +
|
var left = Math.round(
|
||||||
range.start.column *
|
this.$padding + range.start.column * config.characterWidth
|
||||||
config.characterWidth);
|
);
|
||||||
marker.renderer(html, range, left, top, config);
|
marker.renderer(html, range, left, top, config);
|
||||||
}
|
}
|
||||||
else if (range.isMultiLine()) {
|
else if (range.isMultiLine()) {
|
||||||
if (marker.type == "text") {
|
if (marker.type == "text") {
|
||||||
this.drawTextMarker(html, range, marker.clazz, config);
|
this.drawTextMarker(html, range, marker.clazz, config);
|
||||||
} else {
|
} else {
|
||||||
this.drawMultiLineMarker(html, range, marker.clazz, config);
|
this.drawMultiLineMarker(
|
||||||
|
html, range, marker.clazz, config,
|
||||||
|
marker.type === "background"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.drawSingleLineMarker(html, range, marker.clazz, config);
|
this.drawSingleLineMarker(
|
||||||
|
html, range, marker.clazz, config,
|
||||||
|
null, marker.type === "background"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||||
|
|
@ -13905,20 +13919,25 @@ var Marker = function(parentEl) {
|
||||||
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
|
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a marker, which spans a range of text in a single line
|
||||||
|
*/
|
||||||
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
|
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
|
||||||
// selection start
|
// selection start
|
||||||
var row = range.start.row;
|
var row = range.start.row;
|
||||||
|
|
||||||
var lineRange = new Range(row, range.start.column,
|
var lineRange = new Range(
|
||||||
row, this.session.getScreenLastRowColumn(row));
|
row, range.start.column,
|
||||||
|
row, this.session.getScreenLastRowColumn(row)
|
||||||
|
);
|
||||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1);
|
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1);
|
||||||
|
|
||||||
// selection end
|
// selection end
|
||||||
var row = range.end.row;
|
row = range.end.row;
|
||||||
var lineRange = new Range(row, 0, row, range.end.column);
|
lineRange = new Range(row, 0, row, range.end.column);
|
||||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig);
|
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig);
|
||||||
|
|
||||||
for (var row = range.start.row + 1; row < range.end.row; row++) {
|
for (row = range.start.row + 1; row < range.end.row; row++) {
|
||||||
lineRange.start.row = row;
|
lineRange.start.row = row;
|
||||||
lineRange.end.row = row;
|
lineRange.end.row = row;
|
||||||
lineRange.end.column = this.session.getScreenLastRowColumn(row);
|
lineRange.end.column = this.session.getScreenLastRowColumn(row);
|
||||||
|
|
@ -13926,12 +13945,18 @@ var Marker = function(parentEl) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig) {
|
/**
|
||||||
|
* Draws a multi line marker, where lines span the full width
|
||||||
|
*/
|
||||||
|
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, ignorePadding) {
|
||||||
// from selection start to the end of the line
|
// from selection start to the end of the line
|
||||||
|
var padding = ignorePadding ? 0 : this.$padding;
|
||||||
var height = layerConfig.lineHeight;
|
var height = layerConfig.lineHeight;
|
||||||
var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
|
var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
|
||||||
var top = this.$getTop(range.start.row, layerConfig);
|
var top = this.$getTop(range.start.row, layerConfig);
|
||||||
var left = Math.round(range.start.column * layerConfig.characterWidth);
|
var left = Math.round(
|
||||||
|
padding + range.start.column * layerConfig.characterWidth
|
||||||
|
);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
|
|
@ -13942,36 +13967,44 @@ var Marker = function(parentEl) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// from start of the last line to the selection end
|
// from start of the last line to the selection end
|
||||||
var top = this.$getTop(range.end.row, layerConfig);
|
top = this.$getTop(range.end.row, layerConfig);
|
||||||
var width = Math.round(range.end.column * layerConfig.characterWidth);
|
width = Math.round(range.end.column * layerConfig.characterWidth);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
"height:", height, "px;",
|
"height:", height, "px;",
|
||||||
|
"width:", width, "px;",
|
||||||
"top:", top, "px;",
|
"top:", top, "px;",
|
||||||
"width:", width, "px;'></div>"
|
"left:", padding, "px;'></div>"
|
||||||
);
|
);
|
||||||
|
|
||||||
// all the complete lines
|
// all the complete lines
|
||||||
var height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
|
height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
|
||||||
if (height < 0)
|
if (height < 0)
|
||||||
return;
|
return;
|
||||||
var top = this.$getTop(range.start.row + 1, layerConfig);
|
top = this.$getTop(range.start.row + 1, layerConfig);
|
||||||
|
width = layerConfig.width;
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
"height:", height, "px;",
|
"height:", height, "px;",
|
||||||
"width:", layerConfig.width, "px;",
|
"width:", width, "px;",
|
||||||
"top:", top, "px;'></div>"
|
"top:", top, "px;",
|
||||||
|
"left:", padding, "px;'></div>"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength) {
|
/**
|
||||||
|
* Draws a marker which covers one single full line
|
||||||
|
*/
|
||||||
|
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, ignorePadding) {
|
||||||
|
var padding = ignorePadding ? 0 : this.$padding;
|
||||||
var height = layerConfig.lineHeight;
|
var height = layerConfig.lineHeight;
|
||||||
var width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
|
var width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
|
||||||
var top = this.$getTop(range.start.row, layerConfig);
|
var top = this.$getTop(range.start.row, layerConfig);
|
||||||
var left = Math.round(this.$padding +
|
var left = Math.round(
|
||||||
range.start.column * layerConfig.characterWidth);
|
padding + range.start.column * layerConfig.characterWidth
|
||||||
|
);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
|
|
@ -14712,8 +14745,11 @@ var ScrollBar = function(parent) {
|
||||||
|
|
||||||
parent.appendChild(this.element);
|
parent.appendChild(this.element);
|
||||||
|
|
||||||
|
// in OSX lion the scrollbars appear to have no width. In this case resize
|
||||||
|
// the to show the scrollbar but still pretend that the scrollbar has a width
|
||||||
|
// of 0px
|
||||||
this.width = dom.scrollbarWidth();
|
this.width = dom.scrollbarWidth();
|
||||||
this.element.style.width = this.width + "px";
|
this.element.style.width = (this.width || 15) + "px";
|
||||||
|
|
||||||
event.addListener(this.element, "scroll", this.onScroll.bind(this));
|
event.addListener(this.element, "scroll", this.onScroll.bind(this));
|
||||||
};
|
};
|
||||||
|
|
@ -15207,7 +15243,7 @@ define("text/ace/css/editor.css", [], ".ace_editor {" +
|
||||||
".ace_cursor-layer {" +
|
".ace_cursor-layer {" +
|
||||||
" z-index: 4;" +
|
" z-index: 4;" +
|
||||||
" cursor: text;" +
|
" cursor: text;" +
|
||||||
" pointer-events: none;" +
|
" /* setting pointer-events: none; here will break mouse wheel scrolling in Safari */" +
|
||||||
"}" +
|
"}" +
|
||||||
"" +
|
"" +
|
||||||
".ace_cursor {" +
|
".ace_cursor {" +
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -5158,7 +5158,8 @@ exports.setSelectionEnd = function(textarea, end) {
|
||||||
return textarea.selectionEnd = end;
|
return textarea.selectionEnd = end;
|
||||||
};
|
};
|
||||||
|
|
||||||
});/* ***** BEGIN LICENSE BLOCK *****
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
|
@ -5807,7 +5808,7 @@ var Editor =function(renderer, session) {
|
||||||
} else {
|
} else {
|
||||||
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||||
}
|
}
|
||||||
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "line");
|
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -5917,12 +5918,12 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
|
|
||||||
var start = cursor.column;
|
var start = cursor.column;
|
||||||
var lineState = session.getState(cursor.row);
|
var lineState = session.getState(cursor.row);
|
||||||
var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
|
var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
|
||||||
var line = session.getLine(cursor.row);
|
var line = session.getLine(cursor.row);
|
||||||
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
||||||
var end = session.insert(cursor, text);
|
var end = session.insert(cursor, text);
|
||||||
|
|
||||||
if (transform && transform.selection) {
|
if (transform && transform.selection) {
|
||||||
if (transform.selection.length == 2) { // Transform relative to the current column
|
if (transform.selection.length == 2) { // Transform relative to the current column
|
||||||
|
|
@ -9102,7 +9103,8 @@ var EditSession = function(text, mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getScreenLastRowColumn = function(screenRow) {
|
this.getScreenLastRowColumn = function(screenRow) {
|
||||||
return this.screenToDocumentColumn(screenRow, Number.MAX_VALUE / 10)
|
//return this.screenToDocumentColumn(screenRow, Number.MAX_VALUE / 10)
|
||||||
|
return this.documentToScreenColumn(screenRow, this.doc.getLine(screenRow).length);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDocumentLastRowColumn = function(docRow, docColumn) {
|
this.getDocumentLastRowColumn = function(docRow, docColumn) {
|
||||||
|
|
@ -9473,6 +9475,8 @@ var Selection = function(session) {
|
||||||
_self._dispatchEvent("changeCursor");
|
_self._dispatchEvent("changeCursor");
|
||||||
if (!_self.$isEmpty)
|
if (!_self.$isEmpty)
|
||||||
_self._dispatchEvent("changeSelection");
|
_self._dispatchEvent("changeSelection");
|
||||||
|
if (!_self.$preventUpdateDesiredColumnOnChange && e.old.column != e.value.column)
|
||||||
|
_self.$updateDesiredColumn();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.selectionAnchor.on("change", function() {
|
this.selectionAnchor.on("change", function() {
|
||||||
|
|
@ -9864,7 +9868,11 @@ var Selection = function(session) {
|
||||||
row = fold.start.row;
|
row = fold.start.row;
|
||||||
column = fold.start.column;
|
column = fold.start.column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$preventUpdateDesiredColumnOnChange = true;
|
||||||
this.selectionLead.setPosition(row, column);
|
this.selectionLead.setPosition(row, column);
|
||||||
|
this.$preventUpdateDesiredColumnOnChange = false;
|
||||||
|
|
||||||
if (!preventUpdateDesiredColumn)
|
if (!preventUpdateDesiredColumn)
|
||||||
this.$updateDesiredColumn(this.selectionLead.column);
|
this.$updateDesiredColumn(this.selectionLead.column);
|
||||||
};
|
};
|
||||||
|
|
@ -10172,6 +10180,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
session.documentToScreenPosition(this.start);
|
session.documentToScreenPosition(this.start);
|
||||||
var screenPosEnd =
|
var screenPosEnd =
|
||||||
session.documentToScreenPosition(this.end);
|
session.documentToScreenPosition(this.end);
|
||||||
|
|
||||||
return new Range(
|
return new Range(
|
||||||
screenPosStart.row, screenPosStart.column,
|
screenPosStart.row, screenPosStart.column,
|
||||||
screenPosEnd.row, screenPosEnd.column
|
screenPosEnd.row, screenPosEnd.column
|
||||||
|
|
@ -13844,7 +13853,6 @@ var Marker = function(parentEl) {
|
||||||
this.setPadding = function(padding) {
|
this.setPadding = function(padding) {
|
||||||
this.$padding = padding;
|
this.$padding = padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setSession = function(session) {
|
this.setSession = function(session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
};
|
};
|
||||||
|
|
@ -13860,6 +13868,7 @@ var Marker = function(parentEl) {
|
||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
|
|
||||||
var html = [];
|
var html = [];
|
||||||
for ( var key in this.markers) {
|
for ( var key in this.markers) {
|
||||||
var marker = this.markers[key];
|
var marker = this.markers[key];
|
||||||
|
|
@ -13868,23 +13877,28 @@ var Marker = function(parentEl) {
|
||||||
if (range.isEmpty()) continue;
|
if (range.isEmpty()) continue;
|
||||||
|
|
||||||
range = range.toScreenRange(this.session);
|
range = range.toScreenRange(this.session);
|
||||||
|
|
||||||
if (marker.renderer) {
|
if (marker.renderer) {
|
||||||
var top = this.$getTop(range.start.row, config);
|
var top = this.$getTop(range.start.row, config);
|
||||||
var left = Math.round(this.$padding +
|
var left = Math.round(
|
||||||
range.start.column *
|
this.$padding + range.start.column * config.characterWidth
|
||||||
config.characterWidth);
|
);
|
||||||
marker.renderer(html, range, left, top, config);
|
marker.renderer(html, range, left, top, config);
|
||||||
}
|
}
|
||||||
else if (range.isMultiLine()) {
|
else if (range.isMultiLine()) {
|
||||||
if (marker.type == "text") {
|
if (marker.type == "text") {
|
||||||
this.drawTextMarker(html, range, marker.clazz, config);
|
this.drawTextMarker(html, range, marker.clazz, config);
|
||||||
} else {
|
} else {
|
||||||
this.drawMultiLineMarker(html, range, marker.clazz, config);
|
this.drawMultiLineMarker(
|
||||||
|
html, range, marker.clazz, config,
|
||||||
|
marker.type === "background"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.drawSingleLineMarker(html, range, marker.clazz, config);
|
this.drawSingleLineMarker(
|
||||||
|
html, range, marker.clazz, config,
|
||||||
|
null, marker.type === "background"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||||
|
|
@ -13894,20 +13908,25 @@ var Marker = function(parentEl) {
|
||||||
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
|
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a marker, which spans a range of text in a single line
|
||||||
|
*/
|
||||||
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
|
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
|
||||||
// selection start
|
// selection start
|
||||||
var row = range.start.row;
|
var row = range.start.row;
|
||||||
|
|
||||||
var lineRange = new Range(row, range.start.column,
|
var lineRange = new Range(
|
||||||
row, this.session.getScreenLastRowColumn(row));
|
row, range.start.column,
|
||||||
|
row, this.session.getScreenLastRowColumn(row)
|
||||||
|
);
|
||||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1);
|
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1);
|
||||||
|
|
||||||
// selection end
|
// selection end
|
||||||
var row = range.end.row;
|
row = range.end.row;
|
||||||
var lineRange = new Range(row, 0, row, range.end.column);
|
lineRange = new Range(row, 0, row, range.end.column);
|
||||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig);
|
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig);
|
||||||
|
|
||||||
for (var row = range.start.row + 1; row < range.end.row; row++) {
|
for (row = range.start.row + 1; row < range.end.row; row++) {
|
||||||
lineRange.start.row = row;
|
lineRange.start.row = row;
|
||||||
lineRange.end.row = row;
|
lineRange.end.row = row;
|
||||||
lineRange.end.column = this.session.getScreenLastRowColumn(row);
|
lineRange.end.column = this.session.getScreenLastRowColumn(row);
|
||||||
|
|
@ -13915,12 +13934,18 @@ var Marker = function(parentEl) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig) {
|
/**
|
||||||
|
* Draws a multi line marker, where lines span the full width
|
||||||
|
*/
|
||||||
|
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, ignorePadding) {
|
||||||
// from selection start to the end of the line
|
// from selection start to the end of the line
|
||||||
|
var padding = ignorePadding ? 0 : this.$padding;
|
||||||
var height = layerConfig.lineHeight;
|
var height = layerConfig.lineHeight;
|
||||||
var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
|
var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
|
||||||
var top = this.$getTop(range.start.row, layerConfig);
|
var top = this.$getTop(range.start.row, layerConfig);
|
||||||
var left = Math.round(range.start.column * layerConfig.characterWidth);
|
var left = Math.round(
|
||||||
|
padding + range.start.column * layerConfig.characterWidth
|
||||||
|
);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
|
|
@ -13931,36 +13956,44 @@ var Marker = function(parentEl) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// from start of the last line to the selection end
|
// from start of the last line to the selection end
|
||||||
var top = this.$getTop(range.end.row, layerConfig);
|
top = this.$getTop(range.end.row, layerConfig);
|
||||||
var width = Math.round(range.end.column * layerConfig.characterWidth);
|
width = Math.round(range.end.column * layerConfig.characterWidth);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
"height:", height, "px;",
|
"height:", height, "px;",
|
||||||
|
"width:", width, "px;",
|
||||||
"top:", top, "px;",
|
"top:", top, "px;",
|
||||||
"width:", width, "px;'></div>"
|
"left:", padding, "px;'></div>"
|
||||||
);
|
);
|
||||||
|
|
||||||
// all the complete lines
|
// all the complete lines
|
||||||
var height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
|
height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
|
||||||
if (height < 0)
|
if (height < 0)
|
||||||
return;
|
return;
|
||||||
var top = this.$getTop(range.start.row + 1, layerConfig);
|
top = this.$getTop(range.start.row + 1, layerConfig);
|
||||||
|
width = layerConfig.width;
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
"height:", height, "px;",
|
"height:", height, "px;",
|
||||||
"width:", layerConfig.width, "px;",
|
"width:", width, "px;",
|
||||||
"top:", top, "px;'></div>"
|
"top:", top, "px;",
|
||||||
|
"left:", padding, "px;'></div>"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength) {
|
/**
|
||||||
|
* Draws a marker which covers one single full line
|
||||||
|
*/
|
||||||
|
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, ignorePadding) {
|
||||||
|
var padding = ignorePadding ? 0 : this.$padding;
|
||||||
var height = layerConfig.lineHeight;
|
var height = layerConfig.lineHeight;
|
||||||
var width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
|
var width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
|
||||||
var top = this.$getTop(range.start.row, layerConfig);
|
var top = this.$getTop(range.start.row, layerConfig);
|
||||||
var left = Math.round(this.$padding +
|
var left = Math.round(
|
||||||
range.start.column * layerConfig.characterWidth);
|
padding + range.start.column * layerConfig.characterWidth
|
||||||
|
);
|
||||||
|
|
||||||
stringBuilder.push(
|
stringBuilder.push(
|
||||||
"<div class='", clazz, "' style='",
|
"<div class='", clazz, "' style='",
|
||||||
|
|
@ -14701,8 +14734,11 @@ var ScrollBar = function(parent) {
|
||||||
|
|
||||||
parent.appendChild(this.element);
|
parent.appendChild(this.element);
|
||||||
|
|
||||||
|
// in OSX lion the scrollbars appear to have no width. In this case resize
|
||||||
|
// the to show the scrollbar but still pretend that the scrollbar has a width
|
||||||
|
// of 0px
|
||||||
this.width = dom.scrollbarWidth();
|
this.width = dom.scrollbarWidth();
|
||||||
this.element.style.width = this.width + "px";
|
this.element.style.width = (this.width || 15) + "px";
|
||||||
|
|
||||||
event.addListener(this.element, "scroll", this.onScroll.bind(this));
|
event.addListener(this.element, "scroll", this.onScroll.bind(this));
|
||||||
};
|
};
|
||||||
|
|
@ -15196,7 +15232,7 @@ __ace_shadowed__.define("text!ace/css/editor.css", [], ".ace_editor {" +
|
||||||
".ace_cursor-layer {" +
|
".ace_cursor-layer {" +
|
||||||
" z-index: 4;" +
|
" z-index: 4;" +
|
||||||
" cursor: text;" +
|
" cursor: text;" +
|
||||||
" pointer-events: none;" +
|
" /* setting pointer-events: none; here will break mouse wheel scrolling in Safari */" +
|
||||||
"}" +
|
"}" +
|
||||||
"" +
|
"" +
|
||||||
".ace_cursor {" +
|
".ace_cursor {" +
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue