From 9a455051bf3145a6a1185c33a6875867c410e47d Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 10 Mar 2021 01:50:50 +0800 Subject: [PATCH] forgot to do dynamic updates of the predictor that'll be handy once we have a real IME --- services/ime-frontend/src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/ime-frontend/src/main.rs b/services/ime-frontend/src/main.rs index 802a87443..fdb8702ae 100644 --- a/services/ime-frontend/src/main.rs +++ b/services/ime-frontend/src/main.rs @@ -400,6 +400,7 @@ impl InputTracker { if !(trigger.punctuation && k.is_ascii_punctuation() || trigger.whitespace && k.is_ascii_whitespace() ) { self.pred_phrase.push(k).expect("IMEF: ran out of space pushing character into prediction phrase"); + update_predictor = true; } } self.characters += 1; @@ -498,6 +499,12 @@ impl InputTracker { if debug1{info!("IMEF: got pc_bound {:?}", pc_bounds);} if update_predictor { + if self.pred_phrase.len() > 0 { + if let Some(pred) = self.predictor { + pred.set_input(self.pred_phrase).expect("IMEF: couldn't update predictor with current input"); + } + } + // Query the prediction engine for the latest predictions if let Some(pred) = self.predictor { for i in 0..self.pred_options.len() {