-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(developer): Add more non-printing characters #9846
Changes from 15 commits
cd27628
bf0a093
7b00306
7bacbb2
1727278
4085612
2064ac4
06cf276
ecae590
9b8097e
25c54d3
024b20a
bfac279
16cd8a6
a02dde9
56a86a8
132c8c7
7ff8d7a
699e1f3
5902c76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { KMX, Osk, TouchLayout, TouchLayoutFileReader, TouchLayoutFileWriter } from "@keymanapp/common-types"; | ||
import { callbacks, IsKeyboardVersion14OrLater, IsKeyboardVersion15OrLater } from "./compiler-globals.js"; | ||
import { callbacks, fk, IsKeyboardVersion14OrLater, IsKeyboardVersion15OrLater, IsKeyboardVersion17OrLater } from "./compiler-globals.js"; | ||
import { JavaScript_Key } from "./javascript-strings.js"; | ||
import { TRequiredKey, CRequiredKeys, CSpecialText10, CSpecialText14, CSpecialText14ZWNJ, CSpecialText14Map } from "./constants.js"; | ||
import { TRequiredKey, CRequiredKeys, CSpecialText, CSpecialText14Map, CSpecialText17Map, CSpecialTextMinVer, CSpecialTextMaxVer } from "./constants.js"; | ||
import { KeymanWebTouchStandardKeyNames, KMWAdditionalKeyNames, VKeyNames } from "./keymanweb-key-codes.js"; | ||
import { KmwCompilerMessages } from "./messages.js"; | ||
|
||
|
@@ -144,9 +144,9 @@ function CheckKey( | |
// Keyman versions before 14 do not support '*special*' labels on non-special keys. | ||
// ZWNJ use, however, is safe because it will be transformed in function | ||
// TransformSpecialKeys14 to '<|>', which does not require the custom OSK font. | ||
if((CSpecialText10.includes(FText) || CSpecialText14.includes(FText)) && | ||
!CSpecialText14ZWNJ.includes(FText) && | ||
!IsKeyboardVersion14OrLater() && | ||
const mapVersion = (fk.fileVersion > CSpecialTextMaxVer ? CSpecialTextMaxVer : fk.fileVersion < CSpecialTextMinVer ? CSpecialTextMinVer : fk.fileVersion); | ||
darcywong00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const specialText = CSpecialText.get(mapVersion); | ||
if(specialText.includes(FText) && | ||
darcywong00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
!([TouchLayout.TouchLayoutKeySp.special, TouchLayout.TouchLayoutKeySp.specialActive].includes(FKeyType))) { | ||
callbacks.reportMessage(KmwCompilerMessages.Warn_TouchLayoutSpecialLabelOnNormalKey({ | ||
keyId: FId, | ||
|
@@ -199,6 +199,22 @@ function TransformSpecialKeys14(FDebug: boolean, sLayoutFile: string): string { | |
return sLayoutFile; | ||
} | ||
|
||
function TransformSpecialKeys17(FDebug: boolean, sLayoutFile: string): string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit WET, based on TransformSpecialKeys14 (ll 188-202) |
||
// Rewrite Special key labels that are only supported in Keyman 17+ | ||
// This code is a little ugly but effective. | ||
if(!IsKeyboardVersion17OrLater()) { | ||
for(let i = 0; i < CSpecialText17Map.length; i++) { | ||
// Assumes the JSON output format will not change | ||
if(FDebug) { | ||
sLayoutFile = sLayoutFile.replaceAll('"text": "'+CSpecialText17Map[i][0]+'"', '"text": this._v>16 ? "'+CSpecialText17Map[i][0]+'" : "'+CSpecialText17Map[i][1]+'"'); | ||
} else { | ||
sLayoutFile = sLayoutFile.replaceAll('"text":"'+CSpecialText17Map[i][0]+'"', '"text":this._v>16?"'+CSpecialText17Map[i][0]+'":"'+CSpecialText17Map[i][1]+'"'); | ||
} | ||
} | ||
Comment on lines
+207
to
+214
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using a multidimensional array here instead of a map, due to the conversion from Delphi. One day should clean this up |
||
} | ||
return sLayoutFile; | ||
} | ||
|
||
export function ValidateLayoutFile(fk: KMX.KEYBOARD, FDebug: boolean, sLayoutFile: string, sVKDictionary: string, displayMap: Osk.PuaMap): VLFOutput { // I4060 // I4139 | ||
let FDictionary: string[] = sVKDictionary.split(/\s+/); | ||
|
||
|
@@ -282,8 +298,10 @@ export function ValidateLayoutFile(fk: KMX.KEYBOARD, FDebug: boolean, sLayoutFil | |
|
||
sLayoutFile = TransformSpecialKeys14(FDebug, sLayoutFile); | ||
|
||
sLayoutFile = TransformSpecialKeys17(FDebug, sLayoutFile); | ||
|
||
return { | ||
output: sLayoutFile, | ||
result | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -665,4 +665,4 @@ | |
], | ||
"displayUnderlying": false | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't add these because we don't have files with these version numbers