mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-06 14:07:32 +00:00
Merge pull request #2518 from keymanapp/fix/web/2516-context-break
fix(web): Hotfixes recent break for text prediction
This commit is contained in:
commit
ea3d276643
1 changed files with 4 additions and 4 deletions
|
|
@ -33,16 +33,16 @@ namespace com.keyman.text.prediction {
|
|||
|
||||
constructor(mock: Mock, config: Configuration) {
|
||||
this.left = mock.getTextBeforeCaret();
|
||||
this.startOfBuffer = this.left._kmwLength() > config.leftContextCodeUnits;
|
||||
this.startOfBuffer = this.left._kmwLength() > config.leftContextCodePoints;
|
||||
if(!this.startOfBuffer) {
|
||||
// Our custom substring version will return the last n characters if param #1 is given -n.
|
||||
this.left = this.left._kmwSubstr(-config.leftContextCodeUnits);
|
||||
this.left = this.left._kmwSubstr(-config.leftContextCodePoints);
|
||||
}
|
||||
|
||||
this.right = mock.getTextAfterCaret();
|
||||
this.endOfBuffer = this.right._kmwLength() > config.rightContextCodeUnits;
|
||||
this.endOfBuffer = this.right._kmwLength() > config.leftContextCodePoints;
|
||||
if(!this.endOfBuffer) {
|
||||
this.right = this.right._kmwSubstr(0, config.rightContextCodeUnits);
|
||||
this.right = this.right._kmwSubstr(0, config.leftContextCodePoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue