void SetMorphemes(string currentMorphemes) { if (currentMorphemes.Length == 0) { // Reconstructing the sandbox rootbox after deleting all morpheme characters // will cause the user to lose the ability to type in the morpheme line (cf. LT-1621). // So just return here, since there are no morphemes to process. return; } using (new SandboxEditMonitorHelper(this, true)) { // This code largely duplicates that found in UpdateMorphBreaks() following the call // to the EditMorphBreaksDlg, with addition of the m_monitorPropChanges flag and setting // the selection to stay in synch with the typing. Modifying the code to more // closely follow that code fixed LT-1023. IVwCacheDa cda = (IVwCacheDa)m_sda; SandboxBase.MorphemeBreaker mb = new SandboxBase.MorphemeBreaker(m_sandbox.Caches, currentMorphemes, m_hvoSbWord, VernWsForPrimaryMorphemeLine, m_sandbox); mb.IchSel = m_ichSel; mb.Run(); m_fNeedMorphemeUpdate = false; m_sandbox.RootBox.Reconstruct(); // Everything changed, more or less. mb.MakeSel(); } }
void SetMorphemes(string currentMorphemes) { if (currentMorphemes.Length == 0) { // Reconstructing the sandbox rootbox after deleting all morpheme characters // will cause the user to lose the ability to type in the morpheme line (cf. LT-1621). // So just return here, since there are no morphemes to process. return; } using (new SandboxEditMonitorHelper(this, true)) { // This code largely duplicates that found in UpdateMorphBreaks() following the call // to the EditMorphBreaksDlg, with addition of the m_monitorPropChanges flag and setting // the selection to stay in synch with the typing. Modifying the code to more // closely follow that code fixed LT-1023. IVwCacheDa cda = (IVwCacheDa)m_sda; SandboxBase.MorphemeBreaker mb = new SandboxBase.MorphemeBreaker(m_sandbox.Caches, currentMorphemes, m_hvoSbWord, VernWsForPrimaryMorphemeLine, m_sandbox); mb.IchSel = m_ichSel; mb.Run(); m_fNeedMorphemeUpdate = false; m_sandbox.RootBox.Reconstruct(); // Everything changed, more or less. mb.MakeSel(); m_infoDelayed = null; if (m_needDelayedSelection) { // Gather up the information needed to recreate the current selection at idle time. var vwsel = m_sandbox.RootBox.Selection; m_infoDelayed = new SelectionHelper.SelInfo(); int cvsli = vwsel.CLevels(false); cvsli--; // CLevels includes the string property itself, but AllTextSelInfo doesn't need it. int ichEnd; m_infoDelayed.rgvsli = SelLevInfo.AllTextSelInfo(vwsel, cvsli, out m_infoDelayed.ihvoRoot, out m_infoDelayed.tagTextProp, out m_infoDelayed.cpropPrevious, out m_infoDelayed.ich, out ichEnd, out m_infoDelayed.ws, out m_infoDelayed.fAssocPrev, out m_infoDelayed.ihvoEnd, out m_infoDelayed.ttpSelProps); Debug.Assert(ichEnd == m_infoDelayed.ich); Application.Idle += RecreateDelayedSelection; } } }