From 4e1d07a76a5f573d9ac720ff770629e69478a5a8 Mon Sep 17 00:00:00 2001 From: Wilmer Ricciotti Date: Wed, 13 Jul 2011 14:36:07 +0000 Subject: [PATCH] more keyboard event tests --- matitaB/matita/matitaweb.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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) -- 2.39.2