have to store the marker ids in the session as well
This commit is contained in:
parent
52c236cea9
commit
55478fdb83
1 changed files with 12 additions and 11 deletions
|
|
@ -71,10 +71,7 @@ var Editor =function(renderer, session) {
|
||||||
this.$mouseHandler = new MouseHandler(this);
|
this.$mouseHandler = new MouseHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$selectionMarker = null;
|
|
||||||
this.$highlightLineMarker = null;
|
|
||||||
this.$blockScrolling = 0;
|
this.$blockScrolling = 0;
|
||||||
|
|
||||||
this.$search = new Search().set({
|
this.$search = new Search().set({
|
||||||
wrap: true
|
wrap: true
|
||||||
});
|
});
|
||||||
|
|
@ -308,28 +305,32 @@ var Editor =function(renderer, session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$updateHighlightActiveLine = function() {
|
this.$updateHighlightActiveLine = function() {
|
||||||
if (this.$highlightLineMarker) {
|
var session = this.getSession();
|
||||||
this.session.removeMarker(this.$highlightLineMarker);
|
|
||||||
|
if (session.$highlightLineMarker) {
|
||||||
|
session.removeMarker(session.$highlightLineMarker);
|
||||||
}
|
}
|
||||||
this.$highlightLineMarker = null;
|
session.$highlightLineMarker = null;
|
||||||
|
|
||||||
if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
||||||
var cursor = this.getCursorPosition();
|
var cursor = this.getCursorPosition();
|
||||||
var range = new Range(cursor.row, 0, cursor.row+1, 0);
|
var range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||||
this.$highlightLineMarker = this.session.addMarker(range, "ace_active_line", "line");
|
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "line");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onSelectionChange = function(e) {
|
this.onSelectionChange = function(e) {
|
||||||
if (this.$selectionMarker) {
|
var session = this.getSession();
|
||||||
this.session.removeMarker(this.$selectionMarker);
|
|
||||||
|
if (session.$selectionMarker) {
|
||||||
|
session.removeMarker(session.$selectionMarker);
|
||||||
}
|
}
|
||||||
this.$selectionMarker = null;
|
session.$selectionMarker = null;
|
||||||
|
|
||||||
if (!this.selection.isEmpty()) {
|
if (!this.selection.isEmpty()) {
|
||||||
var range = this.selection.getRange();
|
var range = this.selection.getRange();
|
||||||
var style = this.getSelectionStyle();
|
var style = this.getSelectionStyle();
|
||||||
this.$selectionMarker = this.session.addMarker(range, "ace_selection", style);
|
session.$selectionMarker = session.addMarker(range, "ace_selection", style);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onCursorChange(e);
|
this.onCursorChange(e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue