diff options
author | Kostas Nakos | 2007-06-02 20:39:04 +0000 |
---|---|---|
committer | Kostas Nakos | 2007-06-02 20:39:04 +0000 |
commit | 9b0d6d08986415923ecf0cb56760edc4d45035c1 (patch) | |
tree | a718bd90b6a510313a1069b3808973666d43f102 /engines | |
parent | 299cbcb059879c71947825cd0a094938b435ebdb (diff) | |
download | scummvm-rg350-9b0d6d08986415923ecf0cb56760edc4d45035c1.tar.gz scummvm-rg350-9b0d6d08986415923ecf0cb56760edc4d45035c1.tar.bz2 scummvm-rg350-9b0d6d08986415923ecf0cb56760edc4d45035c1.zip |
implement most-recently-used scheme for dictionary words
svn-id: r27058
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/predictive.cpp | 18 |
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 |