* added highlightgutterline setting

This commit is contained in:
Ruben Daniels 2012-04-22 17:00:25 -07:00
commit ba4f7e3765

View file

@ -325,6 +325,7 @@ var Editor = function(renderer, session) {
this.$highlightBrackets(); this.$highlightBrackets();
this.$updateHighlightActiveLine(); this.$updateHighlightActiveLine();
this.$updateHighlightGutterLine();
}; };
this.$updateHighlightActiveLine = function() { this.$updateHighlightActiveLine = function() {
@ -332,13 +333,10 @@ var Editor = function(renderer, session) {
if (session.$highlightLineMarker) if (session.$highlightLineMarker)
session.removeMarker(session.$highlightLineMarker); session.removeMarker(session.$highlightLineMarker);
if (typeof this.$lastrow == "number")
this.renderer.removeGutterDecoration(this.$lastrow, "ace_gutter_active_line");
session.$highlightLineMarker = null; session.$highlightLineMarker = null;
this.$lastrow = null;
if (this.getHighlightActiveLine()) { if (this.$highlightActiveLine) {
var cursor = this.getCursorPosition(), var cursor = this.getCursorPosition(),
foldLine = this.session.getFoldLine(cursor.row); foldLine = this.session.getFoldLine(cursor.row);
@ -351,11 +349,20 @@ var Editor = function(renderer, session) {
} }
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");
} }
}; };
this.$updateHighlightGutterLine = function(){
if (typeof this.$lastrow == "number")
this.renderer.removeGutterDecoration(this.$lastrow, "ace_gutter_active_line");
this.$lastrow = null;
if (this.$highlightGutterLine)
this.renderer.addGutterDecoration(
this.$lastrow = this.getCursorPosition().row, "ace_gutter_active_line");
}
this.onSelectionChange = function(e) { this.onSelectionChange = function(e) {
var session = this.getSession(); var session = this.getSession();
@ -370,6 +377,7 @@ var Editor = function(renderer, session) {
session.$selectionMarker = session.addMarker(range, "ace_selection", style); session.$selectionMarker = session.addMarker(range, "ace_selection", style);
} else { } else {
this.$updateHighlightActiveLine(); this.$updateHighlightActiveLine();
this.$updateHighlightGutterLine();
} }
if (this.$highlightSelectedWord) if (this.$highlightSelectedWord)
@ -408,6 +416,7 @@ var Editor = function(renderer, session) {
// Update the active line marker as due to folding changes the current // Update the active line marker as due to folding changes the current
// line range on the screen might have changed. // line range on the screen might have changed.
this.$updateHighlightActiveLine(); this.$updateHighlightActiveLine();
this.$updateHighlightGutterLine();
// TODO: This might be too much updating. Okay for now. // TODO: This might be too much updating. Okay for now.
this.renderer.updateFull(); this.renderer.updateFull();
}; };
@ -573,7 +582,8 @@ var Editor = function(renderer, session) {
this.$highlightActiveLine = true; this.$highlightActiveLine = true;
this.setHighlightActiveLine = function(shouldHighlight) { this.setHighlightActiveLine = function(shouldHighlight) {
if (this.$highlightActiveLine == shouldHighlight) return; if (this.$highlightActiveLine == shouldHighlight)
return;
this.$highlightActiveLine = shouldHighlight; this.$highlightActiveLine = shouldHighlight;
this.$updateHighlightActiveLine(); this.$updateHighlightActiveLine();
@ -583,6 +593,19 @@ var Editor = function(renderer, session) {
return this.$highlightActiveLine; return this.$highlightActiveLine;
}; };
this.$highlightGutterLine = true;
this.setHighlightGutterLine = function(shouldHighlightGutterLine) {
if (this.$highlightGutterLine == shouldHighlightGutterLine)
return;
this.$highlightGutterLine = shouldHighlightGutterLine;
this.$updateHighlightGutterLine();
};
this.getHighlightGutterLine = function() {
return this.$highlightGutterLine;
};
this.$highlightSelectedWord = true; this.$highlightSelectedWord = true;
this.setHighlightSelectedWord = function(shouldHighlight) { this.setHighlightSelectedWord = function(shouldHighlight) {
if (this.$highlightSelectedWord == shouldHighlight) if (this.$highlightSelectedWord == shouldHighlight)