From f8588c082e2596e91fc66ff8b0c3c850f66c1bfb Mon Sep 17 00:00:00 2001 From: Wilmer Ricciotti Date: Thu, 14 Jul 2011 14:57:04 +0000 Subject: [PATCH] Matitaweb: Bugfix for TeX-macro conversion. --- matitaB/matita/matitaweb.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); } } -- 2.39.2