Merge "Fix highlighting of matches in text of escaped html entities"
This commit is contained in:
commit
dc9af02ffa
@ -79,7 +79,18 @@ public abstract class HighlightSuggestOracle extends SuggestOracle {
|
||||
if (!html) {
|
||||
ds = escape(ds);
|
||||
}
|
||||
displayString = sgi(ds, qstr, "<strong>$1</strong>");
|
||||
|
||||
// We now surround qstr by <strong>. But the chosen approach is not too
|
||||
// smooth, if qstr is small (e.g.: "t") and this small qstr may occur in
|
||||
// escapes (e.g.: "Tim <email@example.org>"). Those escapes will
|
||||
// get <strong>-ed as well (e.g.: "<" -> "&<strong>l</strong>t;"). But
|
||||
// as repairing those mangled escapes is easier than not mangling them in
|
||||
// the first place, we repair them afterwards.
|
||||
ds = sgi(ds, qstr, "<strong>$1</strong>");
|
||||
// Repairing <strong>-ed escapes.
|
||||
ds = sgi(ds, "(&[a-z]*)<strong>([a-z]*)</strong>([a-z]*;)", "$1$2$3");
|
||||
|
||||
displayString = ds;
|
||||
}
|
||||
|
||||
private static native String sgi(String inString, String pat, String newHtml)
|
||||
|
Loading…
Reference in New Issue
Block a user