From: Wilmer Ricciotti Date: Thu, 14 Jul 2011 14:57:04 +0000 (+0000) Subject: Matitaweb: Bugfix for TeX-macro conversion. X-Git-Tag: make_still_working~2371 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=f8588c082e2596e91fc66ff8b0c3c850f66c1bfb;p=helm.git Matitaweb: Bugfix for TeX-macro conversion. --- diff --git a/matitaB/matita/matitaweb.js b/matitaB/matita/matitaweb.js index 0805e0b9a..3400c87e6 100644 --- a/matitaB/matita/matitaweb.js +++ b/matitaB/matita/matitaweb.js @@ -108,7 +108,7 @@ function suppressdefault(e,flag) return !flag; } -function restoreSelection() { +function restoreSelection(adjust) { unlocked.focus(); if (savedRange != null) { if (window.getSelection)//non IE and there is already a selection @@ -117,7 +117,7 @@ function restoreSelection() { if (s.rangeCount > 0) s.removeAllRanges(); range = document.createRange(); - range.setStart(savedsc,savedso); + range.setStart(savedsc,savedso + adjust); range.collapse(true); s.addRange(range); } @@ -156,11 +156,11 @@ function keypress(e) 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); } }