From: Wilmer Ricciotti Date: Wed, 13 Jul 2011 14:36:07 +0000 (+0000) Subject: more keyboard event tests X-Git-Tag: make_still_working~2387 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=4e1d07a76a5f573d9ac720ff770629e69478a5a8;p=helm.git more keyboard event tests --- diff --git a/matitaB/matita/matitaweb.js b/matitaB/matita/matitaweb.js index e6286085a..05629a2cb 100644 --- a/matitaB/matita/matitaweb.js +++ b/matitaB/matita/matitaweb.js @@ -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)