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

index e6286085a1a828f50e976b1045e22bdacc32ffb8..05629a2cb984e081595669b6e7d9ba8a6bf8a064 100644 (file)
@@ -81,6 +81,12 @@ function keyval(n)
     return s;
 }
  
+function string_of_key(n)
+{
+    if (n == null) return 'undefined';
+    return String.fromCharCode(n);
+}
+
 function pressmesg(w,e)
 {
    debug(w + '  keyCode=' + keyval(e.keyCode) +
@@ -106,7 +112,12 @@ function keypress(e)
 {
    if (!e) e= event;
    pressmesg('keypress',e);
-   return suppressdefault(e,/*document.testform.keypress.checked*/ true);
+   var s = string_of_key(e.charCode);
+   if (s == " ") {
+       return suppressdefault(e,true);
+   } else {
+       return suppressdefault(e,false);
+   }
 }
  
 function debug(txt)