mirror of
https://github.com/keymanapp/keyman.git
synced 2026-11-03 09:37:47 +00:00
Merge pull request #2288 from keymanapp/web-2209-cherry-mnemonic-code-handling
cherry(web): Fixes mnemonic code handling issues
This commit is contained in:
commit
aa3abb2ed7
1 changed files with 31 additions and 6 deletions
|
|
@ -149,9 +149,21 @@ namespace com.keyman.text {
|
|||
// kbdInterface.defaultBackspace();
|
||||
// }
|
||||
}
|
||||
} else if(Lkc.Lcode == 8) { //Only desktop UI, not touch devices. TODO: add repeat while mouse down for desktop UI
|
||||
keyman.interface.defaultBackspace();
|
||||
return '';
|
||||
|
||||
// Only desktop UI, not touch devices. TODO: add repeat while mouse down for desktop UI
|
||||
//
|
||||
// Can easily occur from mnemonic keyboards, which create synthetic events without
|
||||
// the appropriate kName value.
|
||||
//
|
||||
// Not strictly if `Lkc.vkCode` is properly maintained, but it's good to have an
|
||||
// extra safety; this would have blocked the backspace bug as well.
|
||||
} else if(Lkc.Lcode == 8) {
|
||||
if(disableDOM) {
|
||||
return '\b'; // the escape sequence for backspace.
|
||||
} else {
|
||||
keyman.interface.defaultBackspace();
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// Translate numpad keystrokes into their non-numpad equivalents
|
||||
|
|
@ -560,13 +572,26 @@ namespace com.keyman.text {
|
|||
mappingEvent[key] = Lkc[key];
|
||||
}
|
||||
|
||||
// To facilitate storing relevant commands, we should probably reverse-lookup
|
||||
// the actual keyname instead.
|
||||
mappingEvent.kName = 'K_xxxx';
|
||||
mappingEvent.Ltarg = null;
|
||||
var mappedChar: string = this.defaultKeyOutput(Lkc, (shifted ? 0x10 : 0), false, true);
|
||||
var mappedChar: string = this.defaultKeyOutput(mappingEvent, (shifted ? 0x10 : 0), false, true);
|
||||
|
||||
/* First, save a backup of the original code. This one won't needlessly trigger keyboard
|
||||
* rules, but allows us to replicate/emulate commands after rule processing if needed.
|
||||
* (Like backspaces)
|
||||
*/
|
||||
Lkc.vkCode = Lkc.Lcode;
|
||||
if(mappedChar) {
|
||||
// FIXME; Warning - will return 96 for 'a', which is a keycode corresponding to Codes.keyCodes('K_NP1') - a numpad key.
|
||||
// Will return 96 for 'a', which is a keycode corresponding to Codes.keyCodes('K_NP1') - a numpad key.
|
||||
// That stated, we're in mnemonic mode - this keyboard's rules are based on the char codes.
|
||||
Lkc.Lcode = mappedChar.charCodeAt(0);
|
||||
} // No 'else' - avoid blocking modifier keys, etc.
|
||||
} else {
|
||||
// Don't let command-type keys (like K_DEL, which will output '.' otherwise!)
|
||||
// trigger keyboard rules.
|
||||
delete Lkc.Lcode;
|
||||
}
|
||||
}
|
||||
|
||||
if(capsActive) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue