when text is wrapped highlight full gutter row and screen row
This commit is contained in:
parent
29d9737b4c
commit
3cbb8dda55
4 changed files with 30 additions and 7 deletions
|
|
@ -717,9 +717,7 @@ var EditSession = function(text, mode) {
|
|||
clazz = "ace_step";
|
||||
|
||||
var range = new Range(startRow, 0, endRow, Infinity);
|
||||
|
||||
var id = this.addMarker(range, clazz, "fullLine", inFront);
|
||||
range.id = id;
|
||||
range.id = this.addMarker(range, clazz, "fullLine", inFront);
|
||||
return range;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -507,10 +507,13 @@ var Editor = function(renderer, session) {
|
|||
session.removeMarker(session.$highlightLineMarker.id);
|
||||
session.$highlightLineMarker = null;
|
||||
} else if (!session.$highlightLineMarker && highlight) {
|
||||
session.$highlightLineMarker = session.highlightLines(highlight.row, highlight.row, "ace_active-line");
|
||||
var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);
|
||||
range.id = session.addMarker(range, "ace_active-line", "screenLine");
|
||||
session.$highlightLineMarker = range;
|
||||
} else if (highlight) {
|
||||
session.$highlightLineMarker.start.row = highlight.row;
|
||||
session.$highlightLineMarker.end.row = highlight.row;
|
||||
session.$highlightLineMarker.start.column = highlight.column;
|
||||
session._emit("changeBackMarker");
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ var Marker = function(parentEl) {
|
|||
marker.renderer(html, range, left, top, config);
|
||||
} else if (marker.type == "fullLine") {
|
||||
this.drawFullLineMarker(html, range, marker.clazz, config);
|
||||
} else if (marker.type == "screenLine") {
|
||||
this.drawScreenLineMarker(html, range, marker.clazz, config);
|
||||
} else if (range.isMultiLine()) {
|
||||
if (marker.type == "text")
|
||||
this.drawTextMarker(html, range, marker.clazz, config);
|
||||
|
|
@ -194,7 +196,19 @@ var Marker = function(parentEl) {
|
|||
"top:", top, "px;",
|
||||
"left:0;right:0;'></div>"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
this.drawScreenLineMarker = function(stringBuilder, range, clazz, config) {
|
||||
var top = this.$getTop(range.start.row, config);
|
||||
var height = config.lineHeight;
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
"height:", height, "px;",
|
||||
"top:", top, "px;",
|
||||
"left:0;right:0;'></div>"
|
||||
);
|
||||
};
|
||||
|
||||
}).call(Marker.prototype);
|
||||
|
||||
|
|
|
|||
|
|
@ -465,8 +465,16 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.$updateGutterLineHighlight = function() {
|
||||
this.$gutterLineHighlight.style.top = this.$cursorLayer.$pixelPos.top - this.layerConfig.offset + "px";
|
||||
this.$gutterLineHighlight.style.height = this.layerConfig.lineHeight + "px";
|
||||
var pos = this.$cursorLayer.$pixelPos;
|
||||
var height = this.layerConfig.lineHeight;
|
||||
if (this.session.getUseWrapMode()) {
|
||||
var cursor = this.session.selection.getCursor();
|
||||
cursor.column = 0;
|
||||
pos = this.$cursorLayer.getPixelPosition(cursor, true);
|
||||
height *= this.session.getRowLength(cursor.row);
|
||||
}
|
||||
this.$gutterLineHighlight.style.top = pos.top - this.layerConfig.offset + "px";
|
||||
this.$gutterLineHighlight.style.height = height + "px";
|
||||
};
|
||||
|
||||
this.$updatePrintMargin = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue