From: Michael M Slusarz Date: Thu, 16 Dec 2010 22:20:46 +0000 (-0700) Subject: Bug #9453: Fix highlighting escaped symbols in autocomplete X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=18447eb6003da2f4bf3848f09417c79c2d8f5ae5;p=horde.git Bug #9453: Fix highlighting escaped symbols in autocomplete --- 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) {