Merge remote-tracking branch 'origin/master' into indent_guides
Conflicts: lib/ace/theme/textmate.css
This commit is contained in:
commit
768bfbb1f2
19 changed files with 155 additions and 153 deletions
|
|
@ -102,6 +102,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.content.className = "ace_content";
|
||||
this.scroller.appendChild(this.content);
|
||||
|
||||
this.setHighlightGutterLine(true);
|
||||
this.$gutterLayer = new GutterLayer(this.$gutter);
|
||||
this.$gutterLayer.on("changeGutterWidth", this.onResize.bind(this, true));
|
||||
|
||||
|
|
@ -481,38 +482,32 @@ var VirtualRenderer = function(container, theme) {
|
|||
dom.removeCssClass(this.$gutter, "ace_fade-fold-widgets");
|
||||
};
|
||||
|
||||
this.$highlightGutterLine = true;
|
||||
this.$highlightGutterLine = false;
|
||||
this.setHighlightGutterLine = function(shouldHighlight) {
|
||||
if (this.$highlightGutterLine == shouldHighlight)
|
||||
return;
|
||||
this.$highlightGutterLine = shouldHighlight;
|
||||
|
||||
this.$loop.schedule(this.CHANGE_GUTTER);
|
||||
if (!this.$gutterLineHighlight) {
|
||||
this.$gutterLineHighlight = dom.createElement("div");
|
||||
this.$gutterLineHighlight.className = "ace_gutter_active_line";
|
||||
this.$gutter.appendChild(this.$gutterLineHighlight);
|
||||
return;
|
||||
}
|
||||
|
||||
this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none";
|
||||
// if cursorlayer have never been updated there's nothing on screen to update
|
||||
if (this.$cursorLayer.$pixelPos)
|
||||
this.$updateGutterLineHighlight();
|
||||
};
|
||||
|
||||
this.getHighlightGutterLine = function() {
|
||||
return this.$highlightGutterLine;
|
||||
};
|
||||
|
||||
this.$updateGutterLineHighlight = function(gutterReady) {
|
||||
var i = this.session.selection.lead.row;
|
||||
if (i == this.$gutterLineHighlight)
|
||||
return;
|
||||
|
||||
if (!gutterReady) {
|
||||
var lineEl, ch = this.$gutterLayer.element.children;
|
||||
var index = this.$gutterLineHighlight - this.layerConfig.firstRow;
|
||||
if (index >= 0 && (lineEl = ch[index]))
|
||||
dom.removeCssClass(lineEl, "ace_gutter_active_line");
|
||||
|
||||
index = i - this.layerConfig.firstRow;
|
||||
if (index >= 0 && (lineEl = ch[index]))
|
||||
dom.addCssClass(lineEl, "ace_gutter_active_line");
|
||||
}
|
||||
|
||||
this.$gutterLayer.removeGutterDecoration(this.$gutterLineHighlight, "ace_gutter_active_line");
|
||||
this.$gutterLayer.addGutterDecoration(i, "ace_gutter_active_line");
|
||||
this.$gutterLineHighlight = i;
|
||||
this.$updateGutterLineHighlight = function() {
|
||||
this.$gutterLineHighlight.style.top = this.$cursorLayer.$pixelPos.top - this.layerConfig.offset + "px";
|
||||
this.$gutterLineHighlight.style.height = this.layerConfig.lineHeight + "px";
|
||||
};
|
||||
|
||||
this.$updatePrintMargin = function() {
|
||||
|
|
@ -706,15 +701,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
// update scrollbar first to not lose scroll position when gutter calls resize
|
||||
this.$updateScrollBar();
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
if (this.showGutter) {
|
||||
if (this.$highlightGutterLine)
|
||||
this.$updateGutterLineHighlight(true);
|
||||
if (this.showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
}
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -726,15 +719,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
else
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
|
||||
if (this.showGutter) {
|
||||
if (this.$highlightGutterLine)
|
||||
this.$updateGutterLineHighlight(true);
|
||||
if (this.showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
}
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -757,7 +748,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (changes & this.CHANGE_CURSOR) {
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight(false);
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
}
|
||||
|
||||
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
|
||||
|
|
@ -799,7 +790,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
// Map lines on the screen to lines in the document.
|
||||
var firstRowScreen, firstRowHeight;
|
||||
var lineHeight = { lineHeight: this.lineHeight };
|
||||
var lineHeight = this.lineHeight;
|
||||
firstRow = session.screenToDocumentRow(firstRow, 0);
|
||||
|
||||
// Check if firstRow is inside of a foldLine. If true, then use the first
|
||||
|
|
@ -810,13 +801,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
|
||||
firstRowScreen = session.documentToScreenRow(firstRow, 0);
|
||||
firstRowHeight = session.getRowHeight(lineHeight, firstRow);
|
||||
firstRowHeight = session.getRowLength(firstRow) * lineHeight;
|
||||
|
||||
lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
|
||||
minHeight = this.$size.scrollerHeight + session.getRowHeight(lineHeight, lastRow)+
|
||||
minHeight = this.$size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
|
||||
firstRowHeight;
|
||||
|
||||
offset = this.scrollTop - firstRowScreen * this.lineHeight;
|
||||
offset = this.scrollTop - firstRowScreen * lineHeight;
|
||||
|
||||
this.layerConfig = {
|
||||
width : longestLine,
|
||||
|
|
@ -824,7 +815,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
firstRow : firstRow,
|
||||
firstRowScreen: firstRowScreen,
|
||||
lastRow : lastRow,
|
||||
lineHeight : this.lineHeight,
|
||||
lineHeight : lineHeight,
|
||||
characterWidth : this.characterWidth,
|
||||
minHeight : minHeight,
|
||||
maxHeight : maxHeight,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue