Fix key repeat workaround for Safari.

Typing "(" now works in Safari
This commit is contained in:
Fabian Jakobs 2010-09-26 19:56:32 +02:00
commit 53ea2aeb17
2 changed files with 32 additions and 30 deletions

View file

@ -17,6 +17,7 @@ require.def("ace/lib/core", function() {
core.isMac = (os == "mac"); core.isMac = (os == "mac");
core.isLinux = (os == "linux"); core.isLinux = (os == "linux");
core.isIE = ! + "\v1"; core.isIE = ! + "\v1";
core.isGecko = window.controllers && window.navigator.product === "Gecko";
core.provide = function(namespace) { core.provide = function(namespace) {
var parts = namespace.split("."); var parts = namespace.split(".");

View file

@ -181,7 +181,8 @@ require.def("ace/lib/event", ["ace/lib/core"], function(core) {
return callback(e); return callback(e);
}); });
if (core.isMac) { // repeated keys are fired as keypress and not keydown events
if (core.isMac && core.isGecko) {
event.addListener(el, "keypress", function(e) { event.addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode; var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) { if (lastDown !== keyId) {