From c8665584e9c9c9df8a31af048e6d1fd29105a8a0 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sat, 5 May 2012 15:14:57 +0100 Subject: [PATCH] Minor fix to stop matching on whitespace chars only Whitespace only chars are now trimmed and so not matched This is a future update (in next version of CodeMirror) that I'm adding now --- CodeMirror-2.24/lib/util/match-highlighter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodeMirror-2.24/lib/util/match-highlighter.js b/CodeMirror-2.24/lib/util/match-highlighter.js index b70cc4c..59098ff 100644 --- a/CodeMirror-2.24/lib/util/match-highlighter.js +++ b/CodeMirror-2.24/lib/util/match-highlighter.js @@ -23,7 +23,7 @@ function markDocument(cm, className, minChars) { clearMarks(cm); minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS); - if (cm.somethingSelected() && cm.getSelection().length >= minChars) { + if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) { var state = getMatchHighlightState(cm); var query = cm.getSelection(); cm.operation(function() {