A bit more deadkey refactoring, + removing one redundant line.

This commit is contained in:
Joshua Horton 2017-11-24 12:08:57 +07:00
parent 489611deba
commit e97d8615bd
2 changed files with 16 additions and 11 deletions

View file

@ -329,8 +329,6 @@ if(!window['keyman']['initialized']) {
* If we 'just activated' the KeymanWeb UI, we need to save the new keyboard change as appropriate.
* If not, we need to activate the control's preferred keyboard.
*/
keyboardID = keymanweb._ActiveKeyboard == null ? '' : keymanweb._ActiveKeyboard['KI'];
if(keymanweb._LastActiveElement._kmwAttachment.keyboard != null) {
keymanweb.setActiveKeyboard(keymanweb._LastActiveElement._kmwAttachment.keyboard,
keymanweb._LastActiveElement._kmwAttachment.languageCode);
@ -348,7 +346,7 @@ if(!window['keyman']['initialized']) {
if(!keymanweb._JustActivatedKeymanWebUI)
{
kbdInterface._DeadKeys = [];
kbdInterface.clearDeadkeys();
keymanweb._NotifyKeyboard(0,target,1); // I2187
}
@ -1328,8 +1326,7 @@ if(!window['keyman']['initialized']) {
keymanweb['resetContext'] = keymanweb.resetContext = function() {
osk.layerId = 'default';
kbdInterface._DeadkeyResetMatched();
kbdInterface._DeadkeyDeleteMatched();
kbdInterface.clearDeadkeys();
kbdInterface.resetContextCache();
keymanweb._ResetVKShift();
@ -2504,7 +2501,7 @@ if(!window['keyman']['initialized']) {
if(!keymanweb._JustActivatedKeymanWebUI)
{
kbdInterface._DeadKeys = [];
kbdInterface.clearDeadkeys();
keymanweb._NotifyKeyboard(0,Ltarg,1); // I2187
}
@ -2997,7 +2994,7 @@ if(!window['keyman']['initialized']) {
keymanweb._Selection = Lrange;
/* Delete deadkeys for IE when certain keys pressed */
kbdInterface._DeadKeys = [];
kbdInterface.clearDeadkeys();
}
}
}
@ -3056,7 +3053,7 @@ if(!window['keyman']['initialized']) {
switch(Levent.Lcode) {
case 8:
kbdInterface._DeadKeys = [];
kbdInterface.clearDeadkeys();
break; // I3318 (always clear deadkeys after backspace)
case 16: //"K_SHIFT":16,"K_CONTROL":17,"K_ALT":18
case 17:

View file

@ -533,9 +533,13 @@ if(!window['keyman']['initialized']) {
}
// Adjust deadkey positions
if(dn >= 0) {
// Pelem.selectionStart seems to exist here in IE 9 and is valid... but is this the right approach?
// I'm probably missing something or other.
var LselectionStart = Pelem.selectionStart;
// Pelem.selectionStart seems to exist here in IE 9 and is valid. This provides a possible approach, but may be wrong.
// It appears safe to model the deadkey adjustment based on the non-IE9 code path's calculations.
if(Pelem._KeymanWebSelectionStart != null) {// changed to allow a value of 0
LselectionStart = Pelem._KeymanWebSelectionStart;
} else {
LselectionStart = Pelem.value._kmwCodeUnitToCodePoint(Pelem.selectionStart); // I3319
}
kbdInterface._DeadkeyDeleteMatched(); // I3318
kbdInterface._DeadkeyAdjustPos(LselectionStart, -dn + s._kmwLength()); // I3318
@ -903,6 +907,10 @@ if(!window['keyman']['initialized']) {
}
}
}
kbdInterface.clearDeadkeys = function() {
kbdInterface._DeadKeys = [];
}
// I3318 - deadkey changes END
/**