Skip to content
Snippets Groups Projects
Commit e9fefaa3 authored by Franck Dary's avatar Franck Dary
Browse files

Ignoring multiwords while moving word index

parent 9032ef49
No related branches found
No related tags found
No related merge requests found
...@@ -443,14 +443,34 @@ bool Config::moveWordIndex(int relativeMovement) ...@@ -443,14 +443,34 @@ bool Config::moveWordIndex(int relativeMovement)
if (!canMoveWordIndex(relativeMovement)) if (!canMoveWordIndex(relativeMovement))
return false; return false;
wordIndex += relativeMovement; int dir = 1;
if (relativeMovement < 0)
dir = -1;
int movementDone = 0;
if (isMultiwordPredicted(wordIndex))
wordIndex += dir;
while (movementDone != relativeMovement)
{
if (isMultiwordPredicted(wordIndex))
wordIndex += dir;
wordIndex += dir;
movementDone += dir;
if (isMultiwordPredicted(wordIndex))
wordIndex += dir;
}
return true; return true;
} }
void Config::moveWordIndexRelaxed(int relativeMovement) void Config::moveWordIndexRelaxed(int relativeMovement)
{ {
while (!moveWordIndex(relativeMovement)); int dir = 1;
if (relativeMovement < 0)
dir = -1;
for (int i = 0; i < abs(relativeMovement); i++)
if (!moveWordIndex(dir))
break;
} }
bool Config::canMoveWordIndex(int relativeMovement) const bool Config::canMoveWordIndex(int relativeMovement) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment