From 378265389de7824750109686dc4fea59d165b857 Mon Sep 17 00:00:00 2001 From: Pierre Kisters <1524059+lhns@users.noreply.github.com> Date: Thu, 1 Oct 2026 04:08:30 +0200 Subject: [PATCH] VR keyboard: unused exports and fields removed textmodel's lastReset (the patch logs the reason itself), __sfuiSwipe.model, corrector's distance/fold and the decoder's N/W/cost/resample exports were read by nothing (patch, tests, replay script). --- modules/vr-keyboard/corrector.js | 6 +++--- modules/vr-keyboard/patch.js | 1 - modules/vr-keyboard/swipe-decoder.js | 6 +++--- modules/vr-keyboard/textmodel.js | 3 +-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/vr-keyboard/corrector.js b/modules/vr-keyboard/corrector.js index fc227fd..37e4d5d 100644 --- a/modules/vr-keyboard/corrector.js +++ b/modules/vr-keyboard/corrector.js @@ -11,7 +11,7 @@ // same-folded variant is >= 1 zipf more frequent ("cant" -> "can't"). // Memory: one folded string + 26 bytes per word. (() => { - const VERSION = 2; + const VERSION = 3; const fold = (w) => w.toLowerCase().replace(/['’-]/g, '') .replace(/ä/g, 'ae').replace(/ö/g, 'oe').replace(/ü/g, 'ue').replace(/ß/g, 'ss'); const VARIANT_GAP = 1.0; @@ -114,8 +114,8 @@ return pickWords(prefix, hits.sort((a, b) => dict.freq[b] - dict.freq[a]), max); } - return { corrections, completions, setLayout, distance }; + return { corrections, completions, setLayout }; } - return { VERSION, create, fold }; + return { VERSION, create }; })() diff --git a/modules/vr-keyboard/patch.js b/modules/vr-keyboard/patch.js index c0aa32c..058f753 100644 --- a/modules/vr-keyboard/patch.js +++ b/modules/vr-keyboard/patch.js @@ -156,7 +156,6 @@ // ---- text model, hooks, resets -------------------------------------------------- const model = T.create({ size: O.bufferChars }); - S.model = model; let lastActivity = Date.now(); const activity = () => { lastActivity = Date.now(); }; let refreshQueued = false; diff --git a/modules/vr-keyboard/swipe-decoder.js b/modules/vr-keyboard/swipe-decoder.js index 46aef73..58a8032 100644 --- a/modules/vr-keyboard/swipe-decoder.js +++ b/modules/vr-keyboard/swipe-decoder.js @@ -1,12 +1,12 @@ // swipe-decoder.js: swipe path -> words. Evaluates to { VERSION, parseDict, -// layout, decode, ... }. SHARK2-style template matching (Kristensson & Zhai 2004): +// layout, decode }. SHARK2-style template matching (Kristensson & Zhai 2004): // each word's ideal path runs through its key centres; candidates starting // and ending near the path's ends, with every key near the path, are scored // by point distances of the resampled paths (proportional and DTW), how // closely the path passes their keys in order, path length and frequency. // Distances are in key widths. ' and - are typed, not swiped. (() => { - const VERSION = 3; + const VERSION = 4; const N = 32; // resample points const SKIP = new Set(["'", '-', '\u2019']); // Cost weights and pruning limits (tuned with tests/swipe-decoder.test.mjs; distances in key widths). @@ -225,5 +225,5 @@ return res; } - return { VERSION, N, W, cost, parseDict, layout, decode, resample }; + return { VERSION, parseDict, layout, decode }; })() diff --git a/modules/vr-keyboard/textmodel.js b/modules/vr-keyboard/textmodel.js index 1f8ba40..e73c986 100644 --- a/modules/vr-keyboard/textmodel.js +++ b/modules/vr-keyboard/textmodel.js @@ -9,7 +9,7 @@ // replacement (swipe candidates, corrections, completions) goes through an // intact anchor, so it deletes exactly what it typed or nothing. (() => { - const VERSION = 5; + const VERSION = 6; const TERMINATORS = new Set([...' .,!?;:']); const OPENING = new Set([...'([{<"\'„“‚‘«‹¿¡/@#-_']); // no auto-space after these const isWordChar = (c) => /[\p{L}\p{N}'’-]/u.test(c); @@ -27,7 +27,6 @@ m.startKnown = boundary; m.version++; epoch++; - m.lastReset = why; }, freeze() { epoch++; }, // Returns false if the key reset the model.