=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js 2015-09-23 22:44:57 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js 2015-09-23 23:49:57 +0000 @@ -432,7 +432,7 @@ } else { - code = mappedCode == null ? key : mappedCode; + code = mappedCode === undefined ? key : mappedCode; code = code | 1 << 11; } @@ -454,7 +454,7 @@ return; } - if (mappedCode != null) + if (mappedCode) { code = mappedCode; @@ -562,26 +562,7 @@ // provided by the TYPED event, except the following: if (ctrl) { - if (ch === 50) // '2' - { - // CTRL-@ - code = 0; - } - else if (ch === 54) // '6' - { - // CTRL-^ - code = 30; - } - else if (ch === 45) // '-' - { - // CTRL-_ - code = 31; - } - else if (ch === 0) // - { - // CTRL-DEL is processed by keyPressed - return; - } + code = p2j.keymap.processCtrl(evt, ch); } // normal processing: the preprocessed character is returned directly @@ -697,7 +678,8 @@ */ function ctrlTyped(key) { - return (key >= 97 && key <= 122) || (key >= 65 && key <= 90); + return (key >= 97 && key <= 122) || (key >= 65 && key <= 90) || key === 50 || + key === 54 || key === 45 || key === 173 || key === 109 || key >= 92 && key <= 95; }; }; === modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js' --- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js 2015-09-23 22:44:57 +0000 +++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js 2015-09-23 23:50:24 +0000 @@ -764,6 +764,64 @@ p2j.keymap = (function() { + + /** + * Process CTRL key. + * + * @param {KeyboardEvent} evt + * The event object. + * @param {Number} code + * The char code. + * @param {Boolean} isChui + * The CHUI mode. + * + * @return {Number} + * The mapped key code. + */ + function processCtrlModifier(evt, code, isChui) + { + var ctrlCode = -1; + + if (evt.ctrlKey) + { + if (code === 50) //'2' + { + ctrlCode = 0; + } + else if (code === 54) //'6' + { + ctrlCode = 30; + } + else if (code === 45) //'-' + { + ctrlCode = 31; + } + else if (code === 92) //'\' + { + ctrlCode = 28; + } + else if (code === 93) //']' + { + ctrlCode = 29; + } + else + { + if (code >= 32 && code < 127) + { + // clear bit 7 (e.g. this takes CTRL-C which is 0x43/decimal 67 and yields 0x03) + ctrlCode = code & 0xffbf; + + // VK_ESCAPE is NOT DELIVERED, 4GL doesn't ever return this + if (isChui && ctrlCode === keys.ESCAPE) + { + ctrlCode = -1; + } + } + } + } + + return ctrlCode; + }; /** * Creates browser keys to Progress CHUI keys mapping. * @@ -987,47 +1045,7 @@ */ function processCtrl(evt, code) { - var ctrlCode = -1; - - if (evt.ctrlKey) - { - if (code === 50) //'2' - { - ctrlCode = 0; - } - else if (code === 54) //'6' - { - ctrlCode = 30; - } - else if (code === 45) //'-' - { - ctrlCode = 31; - } - else if (code === 92) //'\' - { - ctrlCode = 28; - } - else if (code === 93) //']' - { - ctrlCode = 29; - } - else - { - if (code >= 32 && code < 127) - { - // clear bit 7 (e.g. this takes CTRL-C which is 0x43/decimal 67 and yields 0x03) - ctrlCode = code & 0xffbf; - - // VK_ESCAPE is NOT DELIVERED, 4GL doesn't ever return this - if (ctrlCode === keys.ESCAPE) - { - ctrlCode = -1; - } - } - } - } - - return ctrlCode; + return processCtrlModifier(evt, code, true); }; } @@ -1342,6 +1360,26 @@ (113 <= code && code <= 116) || (code == 121) || (123 == code) || (code == 124) || code == 128 || (137 <= code && code <= 140); } + + this.processCtrl = processCtrl; + + /** + * Process CTRL key. + * + * @param {KeyboardEvent} evt + * The event object. + * + * @param {Number} code + * The char code. + * + * @return {Number} + * The mapped key code. + */ + function processCtrl(evt, code) + { + return processCtrlModifier(evt, code, false); + }; + } /**