From 18447eb6003da2f4bf3848f09417c79c2d8f5ae5 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 16 Dec 2010 15:20:46 -0700 Subject: [PATCH] Bug #9453: Fix highlighting escaped symbols in autocomplete --- framework/Core/js/autocomplete.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/framework/Core/js/autocomplete.js b/framework/Core/js/autocomplete.js index 28256d1b5..5cf28e565 100644 --- a/framework/Core/js/autocomplete.js +++ b/framework/Core/js/autocomplete.js @@ -112,13 +112,23 @@ Autocompleter.Base = Class.create({ this.knl.hide(); } } else { - re = new RegExp("(" + this.getToken() + ")", "i"); + re = new RegExp(this.getToken(), "i"); choices.each(function(n) { - c.push({ - l: n.escapeHTML().gsub(re, '#{1}'), - v: n + var m = n.match(re), + out = { l: '', v: n }; + + n.match(re).each(function(m) { + var idx = n.indexOf(m); + out.l += n.substr(0, idx).escapeHTML() + '' + m.escapeHTML() + ''; + n = n.substr(idx + m.length); }); + + if (n.length) { + out.l += n.escapeHTML(); + } + + c.push(out); }); if (!this.knl) { -- 2.11.0