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