From 55478fdb834d03ba4a0f0e2d974628f01f19c9cf Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 14 Feb 2011 08:05:59 +0100 Subject: [PATCH] have to store the marker ids in the session as well --- lib/ace/editor.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/ace/editor.js b/lib/ace/editor.js index a18cbd02..60a14c1b 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -71,10 +71,7 @@ var Editor =function(renderer, session) { this.$mouseHandler = new MouseHandler(this); } - this.$selectionMarker = null; - this.$highlightLineMarker = null; this.$blockScrolling = 0; - this.$search = new Search().set({ wrap: true }); @@ -308,28 +305,32 @@ var Editor =function(renderer, session) { }; this.$updateHighlightActiveLine = function() { - if (this.$highlightLineMarker) { - this.session.removeMarker(this.$highlightLineMarker); + var session = this.getSession(); + + if (session.$highlightLineMarker) { + session.removeMarker(session.$highlightLineMarker); } - this.$highlightLineMarker = null; + session.$highlightLineMarker = null; if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) { var cursor = this.getCursorPosition(); 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) { - if (this.$selectionMarker) { - this.session.removeMarker(this.$selectionMarker); + var session = this.getSession(); + + if (session.$selectionMarker) { + session.removeMarker(session.$selectionMarker); } - this.$selectionMarker = null; + session.$selectionMarker = null; if (!this.selection.isEmpty()) { var range = this.selection.getRange(); var style = this.getSelectionStyle(); - this.$selectionMarker = this.session.addMarker(range, "ace_selection", style); + session.$selectionMarker = session.addMarker(range, "ace_selection", style); } this.onCursorChange(e);