return !flag;
}
-function restoreSelection() {
+function restoreSelection(adjust) {
unlocked.focus();
if (savedRange != null) {
if (window.getSelection)//non IE and there is already a selection
if (s.rangeCount > 0)
s.removeAllRanges();
range = document.createRange();
- range.setStart(savedsc,savedso);
+ range.setStart(savedsc,savedso + adjust);
range.collapse(true);
s.addRange(range);
}
sym = lookup_tex(match);
if (typeof sym != "undefined") {
unlocked.innerHTML = pre + sym + " " + post;
- restoreSelection();
+ restoreSelection(sym.length - match.length);
return suppressdefault(e,true);
}
else {
- restoreSelection();
+ // restoreSelection(0);
return suppressdefault(e,false);
}
}