* Added active line highlighting for the gutter
This commit is contained in:
parent
770ab82cbf
commit
d6c3e006b6
3 changed files with 25 additions and 13 deletions
|
|
@ -189,6 +189,10 @@
|
|||
z-index: 2;
|
||||
}
|
||||
|
||||
.ace_gutter .ace_gutter_active_line{
|
||||
background-color : #dcdcdc;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selected_word {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ var Editor = function(renderer, session) {
|
|||
else
|
||||
lastRow = Infinity;
|
||||
this.renderer.updateLines(range.start.row, lastRow);
|
||||
|
||||
|
||||
this._emit("change", e);
|
||||
|
||||
// update cursor because tab characters can influence the cursor position
|
||||
|
|
@ -334,21 +334,29 @@ var Editor = function(renderer, session) {
|
|||
this.$updateHighlightActiveLine = function() {
|
||||
var session = this.getSession();
|
||||
|
||||
if (session.$highlightLineMarker) {
|
||||
if (session.$highlightLineMarker)
|
||||
session.removeMarker(session.$highlightLineMarker);
|
||||
}
|
||||
session.$highlightLineMarker = null;
|
||||
if (typeof this.$lastrow == "number")
|
||||
this.renderer.removeGutterDecoration(this.$lastrow, "ace_gutter_active_line");
|
||||
|
||||
if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
||||
session.$highlightLineMarker = null;
|
||||
this.$lastrow = null;
|
||||
|
||||
if (this.getHighlightActiveLine()) {
|
||||
var cursor = this.getCursorPosition(),
|
||||
foldLine = this.session.getFoldLine(cursor.row);
|
||||
var range;
|
||||
if (foldLine) {
|
||||
range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
|
||||
} else {
|
||||
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||
|
||||
if ((this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
||||
var range;
|
||||
if (foldLine) {
|
||||
range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
|
||||
} else {
|
||||
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||
}
|
||||
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
|
||||
}
|
||||
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
|
||||
|
||||
this.renderer.addGutterDecoration(this.$lastrow = cursor.row, "ace_gutter_active_line");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@ var Gutter = function(parentEl) {
|
|||
this.addGutterDecoration = function(row, className){
|
||||
if (!this.$decorations[row])
|
||||
this.$decorations[row] = "";
|
||||
this.$decorations[row] += " ace_" + className;
|
||||
this.$decorations[row] += " " + className;
|
||||
};
|
||||
|
||||
this.removeGutterDecoration = function(row, className){
|
||||
this.$decorations[row] = this.$decorations[row].replace(" ace_" + className, "");
|
||||
this.$decorations[row] = this.$decorations[row].replace(" " + className, "");
|
||||
};
|
||||
|
||||
this.setBreakpoints = function(rows) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue