aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/predictive.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp
index 9f06f9b1ff..f6319630d3 100644
--- a/engines/agi/predictive.cpp
+++ b/engines/agi/predictive.cpp
@@ -250,8 +250,8 @@ bool AgiEngine::predictiveDialog(void) {
key = doPollKeyboard();
switch (key) {
case KEY_ENTER:
- rc = true;
- goto press;
+ active = 13;
+ goto processkey;
case KEY_ESCAPE:
rc = false;
goto getout;
@@ -266,10 +266,14 @@ processkey:
needRefresh = true;
lastactive = active;
if (active == 15 && mode != kModeNum) { // Space
- strncpy(temp, _currentWord.c_str(), _currentCode.size());
+ // bring MRU word at the top of the list when changing words
+ if (mode == kModePre && _activeTreeNode && _activeTreeNode->words.size() > 1 && _wordNumber != 0) {
+ String tmpstr = _activeTreeNode->words.remove_at(_wordNumber);
+ _activeTreeNode->words.insert_at(0, tmpstr);
+ }
+ strncpy(temp, _currentWord.c_str(), _currentCode.size());
temp[_currentCode.size()] = 0;
-
prefix += temp;
prefix += " ";
_currentCode.clear();
@@ -331,6 +335,12 @@ processkey:
} else if (active == 10) { // add
debug(0, "add");
} else if (active == 13) { // Ok
+ // bring MRU word at the top of the list when ok'ed out of the dialog
+ if (mode == kModePre && _activeTreeNode && _activeTreeNode->words.size() > 1 && _wordNumber != 0) {
+ String tmpstr = _activeTreeNode->words.remove_at(_wordNumber);
+ _activeTreeNode->words.insert_at(0, tmpstr);
+ }
+
rc = true;
goto press;
} else if (active == 14) { // Mode