]> matita.cs.unibo.it Git - helm.git/commitdiff
more keyboard tests.
authorWilmer Ricciotti <ricciott@cs.unibo.it>
Wed, 13 Jul 2011 15:00:43 +0000 (15:00 +0000)
committerWilmer Ricciotti <ricciott@cs.unibo.it>
Wed, 13 Jul 2011 15:00:43 +0000 (15:00 +0000)
matitaB/matita/matitaweb.js

index 0cf29e3493241df078acf5bd79e4aaa73f67c2f2..1088f51ce9047d3be85394ef4e565a7b8d653dc7 100644 (file)
@@ -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);
    }