From: Wilmer Ricciotti Date: Wed, 13 Jul 2011 15:00:43 +0000 (+0000) Subject: more keyboard tests. X-Git-Tag: make_still_working~2385 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=7b1406845cc6a9885114c8be79224f2b0a17d700;p=helm.git more keyboard tests. --- diff --git a/matitaB/matita/matitaweb.js b/matitaB/matita/matitaweb.js index 0cf29e349..1088f51ce 100644 --- a/matitaB/matita/matitaweb.js +++ b/matitaB/matita/matitaweb.js @@ -114,11 +114,19 @@ function keypress(e) pressmesg('keypress',e); var s = string_of_key(e.charCode); if (s == " ") { - i = unlocked.innerHTML.lastIndexOf('\\',getCursorPos()); + j = getCursorPos(); + i = unlocked.innerHTML.lastIndexOf('\\',j); if (i >= 0) { - window.alert("found " + unlocked.innerHTML.substring(i,getCursorPos())); + match = unlocked.innerHTML.substring(i,j); + pre = unlocked.innerHTML.substring(0,i-1); + post = unlocked.innerHTML.substring(j+1); + if (match == '\\to') { + unlocked.innerHTML = pre + "-> " + post; + return suppressdefault(e,true); + } + else return suppressdefault(e,false); } - return suppressdefault(e,true); + else return suppressdefault(e,false); } else { return suppressdefault(e,false); }