@@ -51,26 +51,16 @@ export function WriteCompiledKeyboard(
5151
5252 setupGlobals ( callbacks , opts , FDebug ?' ' :'' , FDebug ?'\r\n' :'' , kmxResult , keyboard , kmnfile ) ;
5353
54- // let fgp: GROUP;
55-
56- // let fsp: STORE;
57- // let fkp: KEY;
58-
59- // let j: number;
60- // let n: number;
61-
6254 let vMnemonic : number = 0 ;
63- let /*s: string,*/ sRTL : string = "" , sHelp : string = "''" , sHelpFile : string = "" ,
55+ let sRTL : string = "" , sHelp : string = "''" , sHelpFile : string = "" ,
6456 sEmbedJSFilename : string = "" , sEmbedCSSFilename : string = "" ;
6557 let sVisualKeyboardFilename : string = "" , sFullName : string = "" ;
6658 let sBegin_NewContext : string = "" , sBegin_PostKeystroke : string = "" ;
6759 let sLayoutFilename : string = "" , sVKDictionary : string = "" ;
6860 let linecomment : string ; // I3438
69- // let HasRules: boolean;
7061 let sModifierBitmask : string ;
7162 let FOptionStores : string ;
7263 let FKeyboardVersion = "1.0" ;
73- // let rec: TSentinelRecord;
7464
7565 let result = "" ;
7666 // Locate the name of the keyboard
@@ -228,33 +218,32 @@ export function WriteCompiledKeyboard(
228218 const isDebugStore = ( index : number ) => isStoreType ( index , STORETYPE_DEBUG ) ;
229219 const isReservedStore = ( index : number ) => isStoreType ( index , STORETYPE_RESERVED ) ;
230220 const isOptionStore = ( index : number ) => isStoreType ( index , STORETYPE_OPTION ) ;
221+ const getStoreLine = ( index : number ) => kmxResult . extra . stores [ index ] . line ;
231222
232223 // Write the stores out
233224 FOptionStores = '' ;
234225 for ( let i = 0 ; i < keyboard . stores . length ; i ++ ) {
235226 let fsp = keyboard . stores [ i ] ;
236227 // I3438 - Save all system stores to the keyboard, for now // I3684
237228
238- if ( ! isDebugStore ( i ) ) { // and not (fsp.dwSystemID in [TSS_BITMAP, TSS_NAME, TSS_VERSION, TSS_CUSTOMKEYMANEDITION, TSS_CUSTOMKEYMANEDITIONNAME, TSS_KEYMANCOPYRIGHT]) then
229+ if ( ! isDebugStore ( i ) ) {
239230 if ( fsp . dwSystemID == KMX . KMXFile . TSS_COMPARISON ) {
240- result += `${ FTabStop } this.s${ JavaScript_Name ( i , fsp . dpName ) } =${ JavaScript_Store ( keyboard , 0 /*fsp.line*/ , fsp . dpString ) } ;${ nl } ` ;
231+ result += `${ FTabStop } this.s${ JavaScript_Name ( i , fsp . dpName ) } =${ JavaScript_Store ( keyboard , getStoreLine ( i ) , fsp . dpString ) } ;${ nl } ` ;
241232 }
242233 else if ( fsp . dwSystemID == KMX . KMXFile . TSS_COMPILEDVERSION ) {
243- result += `${ FTabStop } this.KVER=${ JavaScript_Store ( keyboard , 0 /*fsp.line*/ , fsp . dpString ) } ;${ nl } ` ;
234+ result += `${ FTabStop } this.KVER=${ JavaScript_Store ( keyboard , getStoreLine ( i ) , fsp . dpString ) } ;${ nl } ` ;
244235 }
245- //else if fsp.dwSystemID = TSS_VKDICTIONARY then // I3438, required for vkdictionary
246- // Result := Result + Format('%sthis.s%s=%s;%s', [FTabStop, JavaScript_Name(i, fsp.szName), JavaScript_Store(fsp.line, fsp.dpString), nl])
247236 else if ( isOptionStore ( i ) && ! isReservedStore ( i ) ) {
248237 result += `${ FTabStop } this.s${ JavaScript_Name ( i , fsp . dpName ) } =KeymanWeb.KLOAD(this.KI,"${ JavaScript_Name ( i , fsp . dpName , true ) } ",` +
249- `${ JavaScript_Store ( keyboard , 0 /*fsp.line*/ , fsp . dpString ) } );${ nl } ` ;
238+ `${ JavaScript_Store ( keyboard , getStoreLine ( i ) , fsp . dpString ) } );${ nl } ` ;
250239
251240 if ( FOptionStores != '' ) {
252241 FOptionStores += ',' ;
253242 }
254243 FOptionStores += `'s${ JavaScript_Name ( i , fsp . dpName ) } '` ;
255244 }
256- else if ( fsp . dwSystemID == KMX . KMXFile . TSS_NONE /* aka not fsp.fIsReserved */ ) {
257- result += `${ FTabStop } this.s${ JavaScript_Name ( i , fsp . dpName ) } =${ JavaScript_Store ( keyboard , 0 /*fsp.line*/ , fsp . dpString ) } ;${ nl } ` ; // I3681
245+ else if ( fsp . dwSystemID == KMX . KMXFile . TSS_NONE /* aka !isReservedStore(i) */ ) {
246+ result += `${ FTabStop } this.s${ JavaScript_Name ( i , fsp . dpName ) } =${ JavaScript_Store ( keyboard , getStoreLine ( i ) , fsp . dpString ) } ;${ nl } ` ; // I3681
258247 }
259248 }
260249 }
0 commit comments