From b029b1993b66588c6cacdf27fd7c79a48e9290b6 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Mon, 22 Jun 2026 13:52:41 -0500 Subject: [PATCH] fix(web): do not auto-select model-matching keep suggestions Fixes: #12312 Do, however, prevent auto-selection of any other suggestion when a model-matching 'keep' is available. Build-bot: skip build:web build:android build:ios --- .../worker-thread/src/main/predict-helpers.ts | 8 +++++--- .../engine/src/interfaces/prediction/predictionContext.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts b/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts index 9739adba856..2f480e7535c 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts @@ -965,9 +965,11 @@ export function predictionAutoSelect(suggestionDistribution: CorrectionPredictio const keepOption = suggestionDistribution[0].prediction.sample as Outcome; if(keepOption.tag == 'keep' && keepOption.matchesModel) { - // Auto-select it for auto-acceptance; we don't correct away from perfectly-valid - // lexical entries, even if they are comparatively low-frequency. - keepOption.autoAccept = true; + // Do not auto-select 'keep' suggestions'; there's no need to apply them. + // + // Do, however, block auto-selection of any other suggestions if we would + // have auto-selected the 'keep'; even if it is comparatively unlikely / + // low-frequency, we 'keep' the current context. return; } else if(suggestionDistribution.length == 1) { return; diff --git a/web/src/engine/src/interfaces/prediction/predictionContext.ts b/web/src/engine/src/interfaces/prediction/predictionContext.ts index 97182a9bf16..b374f504fba 100644 --- a/web/src/engine/src/interfaces/prediction/predictionContext.ts +++ b/web/src/engine/src/interfaces/prediction/predictionContext.ts @@ -266,7 +266,7 @@ export class PredictionContext extends EventEmitter { this._revertSuggestion = s as Reversion; } - if (this.langProcessor.mayAutoCorrect && s.autoAccept && !this.selected) { + if (this.langProcessor.mayAutoCorrect && s.autoAccept && !this.selected && s.tag != 'keep') { this.selected = s; } }