mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-09 08:07:42 +00:00
don't always use the same coordinate when creating fake ComposedData for a word
avoids some sort of cache returning previous suggestions, see GH-1542
This commit is contained in:
parent
120734ff41
commit
31a8761bfa
1 changed files with 2 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
package helium314.keyboard.latin.common
|
package helium314.keyboard.latin.common
|
||||||
|
|
||||||
import helium314.keyboard.latin.WordComposer
|
import helium314.keyboard.latin.WordComposer
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
/** An immutable class that encapsulates a snapshot of word composition data. */
|
/** An immutable class that encapsulates a snapshot of word composition data. */
|
||||||
class ComposedData(
|
class ComposedData(
|
||||||
|
@ -47,7 +48,7 @@ class ComposedData(
|
||||||
val codePoints = StringUtils.toCodePointArray(word)
|
val codePoints = StringUtils.toCodePointArray(word)
|
||||||
val coordinates = CoordinateUtils.newCoordinateArray(codePoints.size)
|
val coordinates = CoordinateUtils.newCoordinateArray(codePoints.size)
|
||||||
for (i in codePoints.indices) {
|
for (i in codePoints.indices) {
|
||||||
CoordinateUtils.setXYInArray(coordinates, i, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE)
|
CoordinateUtils.setXYInArray(coordinates, i, Random.nextBits(2), Random.nextBits(2))
|
||||||
}
|
}
|
||||||
return WordComposer().apply { setComposingWord(codePoints, coordinates) }.composedDataSnapshot
|
return WordComposer().apply { setComposingWord(codePoints, coordinates) }.composedDataSnapshot
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue