mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-14 12:49:25 +00:00
Merge pull request #834 from keymanapp/web-733-beep-stores
[Web] CODE_BEEP in stores
This commit is contained in:
commit
e96be2d4e1
4 changed files with 50 additions and 7 deletions
|
|
@ -1,5 +1,8 @@
|
|||
# KeymanWeb Version History
|
||||
|
||||
## 2018-05-08 10.0.90 beta
|
||||
* Fixes support for Keyman-language 'beep' statements as part of keyboard stores. (#733)
|
||||
|
||||
## 2018-05-07 10.0.89 beta
|
||||
* Fixes an issue with case sensitive virtual keys used by some Keyman keyboards. (#162)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,14 +13,13 @@ namespace com.keyman {
|
|||
* No constructors or methods since keyboards will not utilize the same backing prototype, and
|
||||
* property names are shorthanded to promote minification.
|
||||
*/
|
||||
|
||||
type PlainKeyboardStore = string;
|
||||
|
||||
// TODO: Implement the new 'store object-orientation proposal.
|
||||
export type KeyboardStoreElement = (string|{'d': number});
|
||||
export type KeyboardStoreElement = (string|StoreNonCharEntry);
|
||||
export type ComplexKeyboardStore = KeyboardStoreElement[];
|
||||
|
||||
type KeyboardStore = PlainKeyboardStore | ComplexKeyboardStore;
|
||||
|
||||
type RuleChar = string;
|
||||
|
||||
class RuleDeadkey {
|
||||
|
|
@ -83,9 +82,17 @@ namespace com.keyman {
|
|||
['t']: 'n';
|
||||
}
|
||||
|
||||
class StoreBeep {
|
||||
/** Discriminant field - 'b' for `beep`
|
||||
*/
|
||||
['t']: 'b';
|
||||
}
|
||||
|
||||
type ContextNonCharEntry = RuleDeadkey | ContextAny | RuleIndex | ContextEx | ContextNul;
|
||||
type ContextEntry = RuleChar | ContextNonCharEntry;
|
||||
|
||||
type StoreNonCharEntry = RuleDeadkey | StoreBeep;
|
||||
|
||||
/**
|
||||
* Cache of context storing and retrieving return values from KC
|
||||
* Must be reset prior to each keystroke and after any text changes
|
||||
|
|
@ -470,7 +477,14 @@ namespace com.keyman {
|
|||
}
|
||||
break;
|
||||
case 'a':
|
||||
var lookup = (typeof(context[i]) == 'string' ? context[i] as string : {'d': context[i] as number});
|
||||
var lookup: KeyboardStoreElement;
|
||||
|
||||
if(typeof context[i] == 'string') {
|
||||
lookup = context[i] as string;
|
||||
} else {
|
||||
lookup = {'t': 'd', 'd': context[i] as number};
|
||||
}
|
||||
|
||||
var result = this.any(i, lookup, r.a);
|
||||
|
||||
if(!r.n) { // If it's a standard 'any'...
|
||||
|
|
@ -486,7 +500,8 @@ namespace com.keyman {
|
|||
}
|
||||
break;
|
||||
case 'i':
|
||||
var ch = this._Index(r.i, r.o);
|
||||
// The context will never hold a 'beep.'
|
||||
var ch = this._Index(r.i, r.o) as string | RuleDeadkey;
|
||||
|
||||
if(ch !== undefined && (typeof(ch) == 'string' ? ch : ch.d) !== context[i]) {
|
||||
mismatch = true;
|
||||
|
|
@ -767,11 +782,29 @@ namespace com.keyman {
|
|||
indexOutput(Pdn: number, Ps: KeyboardStore, Pn: number, Pelem: HTMLElement): void {
|
||||
this.resetContextCache();
|
||||
|
||||
var assertNever = function(x: never): never {
|
||||
// Could be accessed by improperly handwritten calls to `fullContextMatch`.
|
||||
throw new Error("Unexpected object in fullContextMatch specification: " + x);
|
||||
}
|
||||
|
||||
var indexChar = this._Index(Ps, Pn);
|
||||
if(indexChar !== "") {
|
||||
if(typeof indexChar == 'string' ) {
|
||||
this.output(Pdn,Pelem,indexChar); //I3319
|
||||
} else {
|
||||
} else if(indexChar['t']) {
|
||||
var storeEntry = indexChar as StoreNonCharEntry;
|
||||
|
||||
switch(storeEntry.t) {
|
||||
case 'b': // Beep commands may appear within stores.
|
||||
this.beep(Pelem);
|
||||
break;
|
||||
case 'd':
|
||||
this.deadkeyOutput(Pdn, Pelem, indexChar['d']);
|
||||
break;
|
||||
default:
|
||||
assertNever(storeEntry);
|
||||
}
|
||||
} else { // For keyboards developed during 10.0's alpha phase - t:'d' was assumed.
|
||||
this.deadkeyOutput(Pdn, Pelem, indexChar['d']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1111,7 +1111,11 @@ begin
|
|||
begin
|
||||
if rec.Code = CODE_DEADKEY then
|
||||
begin
|
||||
Result := Result + Format('{d:%d}', [rec.Deadkey.DeadKey]);
|
||||
Result := Result + Format('{t:''d'',d:%d}', [rec.Deadkey.DeadKey]);
|
||||
end
|
||||
else if rec.Code = CODE_BEEP then
|
||||
begin
|
||||
Result := Result + '{t:''b''}'
|
||||
end
|
||||
else //if rec.Code = CODE_EXTENDED then
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
# Keyman Developer Version History
|
||||
|
||||
## 2018-05-08 10.0.1082.0 beta
|
||||
* Fixes support for 'beep' statements in keyboard stores when compiling for web or mobile targets (#733)
|
||||
|
||||
## 2018-05-03 10.0.1076.0 beta
|
||||
* Restrict modifier options to a small set by default in touch layout editor (#810)
|
||||
* Touch layout editor no longer leaves broken JSON when deleting or modifying some keys (#811)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue