parent
f7786930e9
commit
dfe918e339
2 changed files with 39 additions and 26 deletions
|
|
@ -376,13 +376,6 @@ var EditSession = function(text, mode) {
|
||||||
return token;
|
return token;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.highlight = function(re) {
|
|
||||||
if (!this.$searchHighlight) {
|
|
||||||
var highlight = new SearchHighlight(null, "ace_selected-word", "text");
|
|
||||||
this.$searchHighlight = this.addDynamicMarker(highlight);
|
|
||||||
}
|
|
||||||
this.$searchHighlight.setRegexp(re);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* EditSession.setUndoManager(undoManager)
|
* EditSession.setUndoManager(undoManager)
|
||||||
* - undoManager (UndoManager): The new undo manager
|
* - undoManager (UndoManager): The new undo manager
|
||||||
|
|
@ -736,6 +729,30 @@ var EditSession = function(text, mode) {
|
||||||
return inFront ? this.$frontMarkers : this.$backMarkers;
|
return inFront ? this.$frontMarkers : this.$backMarkers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.highlight = function(re) {
|
||||||
|
if (!this.$searchHighlight) {
|
||||||
|
var highlight = new SearchHighlight(null, "ace_selected-word", "text");
|
||||||
|
this.$searchHighlight = this.addDynamicMarker(highlight);
|
||||||
|
}
|
||||||
|
this.$searchHighlight.setRegexp(re);
|
||||||
|
}
|
||||||
|
|
||||||
|
// experimental
|
||||||
|
this.highlightLines = function(startRow, endRow, clazz, inFront) {
|
||||||
|
if (typeof endRow != "number") {
|
||||||
|
clazz = endRow;
|
||||||
|
endRow = startRow;
|
||||||
|
}
|
||||||
|
if (!clazz)
|
||||||
|
clazz = "ace_step";
|
||||||
|
|
||||||
|
var range = new Range(startRow, 0, endRow, Infinity);
|
||||||
|
|
||||||
|
var id = this.addMarker(range, clazz, "fullLine", inFront);
|
||||||
|
range.id = id;
|
||||||
|
return range;
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error:
|
* Error:
|
||||||
* {
|
* {
|
||||||
|
|
|
||||||
|
|
@ -481,28 +481,24 @@ var Editor = function(renderer, session) {
|
||||||
this.$updateHighlightActiveLine = function() {
|
this.$updateHighlightActiveLine = function() {
|
||||||
var session = this.getSession();
|
var session = this.getSession();
|
||||||
|
|
||||||
if (session.$highlightLineMarker)
|
var highlight;
|
||||||
session.removeMarker(session.$highlightLineMarker);
|
|
||||||
|
|
||||||
session.$highlightLineMarker = null;
|
|
||||||
|
|
||||||
if (this.$highlightActiveLine) {
|
if (this.$highlightActiveLine) {
|
||||||
var cursor = this.getCursorPosition();
|
if ((this.$selectionStyle != "line" || !this.selection.isMultiLine()))
|
||||||
var foldLine = this.session.getFoldLine(cursor.row);
|
highlight = this.getCursorPosition();
|
||||||
|
}
|
||||||
|
|
||||||
if ((this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
if (session.$highlightLineMarker && !highlight) {
|
||||||
var range;
|
session.removeMarker(session.$highlightLineMarker.id);
|
||||||
if (foldLine) {
|
session.$highlightLineMarker = null;
|
||||||
range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
|
} else if (!session.$highlightLineMarker && highlight) {
|
||||||
} else {
|
session.$highlightLineMarker = session.highlightLines(highlight.row, highlight.row, "ace_active-line");
|
||||||
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
} else if (highlight) {
|
||||||
}
|
session.$highlightLineMarker.start.row = highlight.row;
|
||||||
session.$highlightLineMarker = session.addMarker(range, "ace_active-line", "background");
|
session.$highlightLineMarker.end.row = highlight.row;
|
||||||
}
|
session._emit("changeBackMarker");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.onSelectionChange = function(e) {
|
this.onSelectionChange = function(e) {
|
||||||
var session = this.session;
|
var session = this.session;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue