From b6a5e222cdcc81fb1c9afe8cafd5d3e2e014ccba Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 15 May 2014 19:58:03 +0400 Subject: [PATCH] fix Ace on ChromeOS uses wrong keys for Home/End (#1950) --- lib/ace/lib/event.js | 8 ++++++++ lib/ace/lib/useragent.js | 2 ++ 2 files changed, 10 insertions(+) diff --git a/lib/ace/lib/event.js b/lib/ace/lib/event.js index e904e024..39d115b4 100644 --- a/lib/ace/lib/event.js +++ b/lib/ace/lib/event.js @@ -279,6 +279,14 @@ function normalizeCommandKeys(callback, e, keyCode) { return; } } + + if (useragent.isChromeOS && hashId & 8) { + callback(e, hashId, keyCode); + if (e.defaultPrevented) + return; + else + hashId &= ~8; + } // If there is no hashId and the keyCode is not a function key, then // we don't call the callback as we don't handle a command key here diff --git a/lib/ace/lib/useragent.js b/lib/ace/lib/useragent.js index e56e89a9..e539dae3 100644 --- a/lib/ace/lib/useragent.js +++ b/lib/ace/lib/useragent.js @@ -101,4 +101,6 @@ exports.isIPad = ua.indexOf("iPad") >= 0; exports.isTouchPad = ua.indexOf("TouchPad") >= 0; +exports.isChromeOS = ua.indexOf(" CrOS ") >= 0; + });