[dasher] AlphabetManager::GetRoot never sets NF_SEEN, DasherModel does if appropriate



commit 73dc7c7575db3c366ff67f3e7bdbbc97d179d4aa
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Thu Sep 2 19:14:09 2010 +0100

    AlphabetManager::GetRoot never sets NF_SEEN, DasherModel does if appropriate

 Src/DasherCore/AlphabetManager.cpp |    1 -
 Src/DasherCore/AlphabetManager.h   |    1 +
 Src/DasherCore/DasherModel.cpp     |   12 +++++++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 793b3a0..4e03a43 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -142,7 +142,6 @@ CAlphabetManager::CAlphNode *CAlphabetManager::GetRoot(CDasherNode *pParent, uns
     // represents a symbol that's already happened - so we're either
     // going backwards (rebuildParent) or creating a new root after a language change
     DASHER_ASSERT (!pParent);
-    pNewNode->SetFlag(NF_SEEN, true);
   }
 
   pNewNode->iContext = iContext;
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index cafa89a..3d7a3b7 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -123,6 +123,7 @@ namespace Dasher {
     /// bEnteredLast - true if this "root" node should be considered as entering the preceding symbol
     /// Offset is the index of the character which _child_ nodes (i.e. between which this root allows selection)
     /// will enter. (Also used to build context for preceding characters.)
+    /// Note, the new node will _not_ be NF_SEEN
     virtual CAlphNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset);
 
     const CAlphInfo *GetAlphabet() const;
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index a8fcd5a..66555bf 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -233,7 +233,17 @@ void CDasherModel::SetOffset(int iOffset, CAlphabetManager *pMgr, CDasherView *p
   delete m_Root;
   
   m_Root = pMgr->GetRoot(NULL, 0,GetLongParameter(LP_NORMALIZATION), iOffset!=0, iOffset);
-  m_pLastOutput = (m_Root->GetFlag(NF_SEEN)) ? m_Root : NULL;
+  if (iOffset) {
+    //there were preceding characters. It's nonetheless possible that they weren't
+    // part of the current alphabet, and so we may have got a simple group node as root,
+    // rather than a character node (responsible for the last said preceding character),
+    // but even so, it seems fair enough to say we've "seen" the root:
+    m_Root->SetFlag(NF_SEEN, true);
+    m_Root->Enter();
+    // (of course, we don't do Output() - the context contains it already!)
+    m_pLastOutput = m_Root;
+  } else
+    m_pLastOutput = NULL;
   
   // Create children of the root...
   ExpandNode(m_Root);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]