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
This commit is contained in:
Matt Pass
2012-05-05 15:14:57 +01:00
parent c56af14f52
commit c8665584e9

View File

@@ -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() {