| 1 |
diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js |
| 2 |
index 23fc3fc..ed3b273 100644 |
| 3 |
--- a/lib/ace/edit_session.js |
| 4 |
+++ b/lib/ace/edit_session.js |
| 5 |
@@ -51,6 +51,7 @@ var TextMode = require("./mode/text").Mode; |
| 6 |
var Range = require("./range").Range; |
| 7 |
var Document = require("./document").Document; |
| 8 |
var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; |
| 9 |
+var SearchHighlight = require("./search_highlight").SearchHighlight; |
| 10 |
|
| 11 |
/** |
| 12 |
* class EditSession |
| 13 |
@@ -307,6 +308,13 @@ var EditSession = function(text, mode) { |
| 14 |
return token; |
| 15 |
}; |
| 16 |
|
| 17 |
+ this.highlight = function(re) { |
| 18 |
+ if (!this.$searchHighlight) { |
| 19 |
+ var highlight = new SearchHighlight(null, "ace_selected-word", "text"); |
| 20 |
+ this.$searchHighlight = this.addDynamicMarker(highlight); |
| 21 |
+ } |
| 22 |
+ this.$searchHighlight.setRegexp(re); |
| 23 |
+ } |
| 24 |
/** |
| 25 |
* EditSession.setUndoManager(undoManager) |
| 26 |
* - undoManager (UndoManager): The new undo manager |
| 27 |
@@ -556,7 +564,8 @@ var EditSession = function(text, mode) { |
| 28 |
type : type || "line", |
| 29 |
renderer: typeof type == "function" ? type : null, |
| 30 |
clazz : clazz, |
| 31 |
- inFront: !!inFront |
| 32 |
+ inFront: !!inFront, |
| 33 |
+ id: id |
| 34 |
} |
| 35 |
|
| 36 |
if (inFront) { |
| 37 |
diff --git a/lib/ace/editor.js b/lib/ace/editor.js |
| 38 |
index 834e603..b27ec73 100644 |
| 39 |
--- a/lib/ace/editor.js |
| 40 |
+++ b/lib/ace/editor.js |
| 41 |
@@ -494,7 +494,7 @@ var Editor = function(renderer, session) { |
| 42 |
* Emitted when a selection has changed. |
| 43 |
**/ |
| 44 |
this.onSelectionChange = function(e) { |
| 45 |
- var session = this.getSession(); |
| 46 |
+ var session = this.session; |
| 47 |
|
| 48 |
if (session.$selectionMarker) { |
| 49 |
session.removeMarker(session.$selectionMarker); |
| 50 |
@@ -509,12 +509,40 @@ var Editor = function(renderer, session) { |
| 51 |
this.$updateHighlightActiveLine(); |
| 52 |
} |
| 53 |
|
| 54 |
- var self = this; |
| 55 |
- if (this.$highlightSelectedWord && !this.$wordHighlightTimer) |
| 56 |
- this.$wordHighlightTimer = setTimeout(function() { |
| 57 |
- self.session.$mode.highlightSelection(self); |
| 58 |
- self.$wordHighlightTimer = null; |
| 59 |
- }, 30, this); |
| 60 |
+ var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp() |
| 61 |
}; |
| 62 |
diff --git a/lib/ace/search_highlight.js b/lib/ace/search_highlight.js |
| 63 |
new file mode 100644 |
| 64 |
index 0000000..b2df779 |
| 65 |
--- /dev/null |
| 66 |
+++ b/lib/ace/search_highlight.js |
| 67 |
@@ -0,0 +1,3 @@ |
| 68 |
+new |
| 69 |
+empty file |