fix key input for windows

This commit is contained in:
Fabian Jakobs 2010-05-13 16:58:33 +02:00
commit 7fa11b08d1
2 changed files with 19 additions and 11 deletions

View file

@ -3,6 +3,12 @@ if (!window.ace)
(function() {
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
this.isWin = (os == "win");
this.isMac = (os == "mac");
this.isLinux = (os == "linux");
this.provide = function(namespace) {
var parts = namespace.split(".");
var obj = window;

View file

@ -149,13 +149,15 @@
return callback(e);
});
self.addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) {
return callback(e);
} else {
lastDown = null;
}
});
if (ace.isMac) {
self.addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) {
return callback(e);
} else {
lastDown = null;
}
});
}
};
}).call(ace);