4
<title>CodeMirror: Match Highlighter Demo</title>
5
<link rel="stylesheet" href="../lib/codemirror.css">
6
<script src="../lib/codemirror.js"></script>
7
<script src="../lib/util/searchcursor.js"></script>
8
<script src="../lib/util/match-highlighter.js"></script>
9
<link rel="stylesheet" href="../doc/docs.css">
11
<style type="text/css">
12
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
14
span.CodeMirror-matchhighlight { background: #e9e9e9 }
15
.CodeMirror-focused span.CodeMirror-matchhighlight { background: #e7e4ff; !important }
19
<h1>CodeMirror: Match Highlighter Demo</h1>
21
<form><textarea id="code" name="code">Select this text: hardToSpotVar
22
And everywhere else in your code where hardToSpotVar appears will automatically illuminate.
23
Give it a try! No more hardToSpotVars.</textarea></form>
26
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
28
onCursorActivity: function() {
29
editor.matchHighlight("CodeMirror-matchhighlight");
34
<p>Highlight matches of selected text on select</p>