| 23 | } |
| 24 | |
| 25 | void ZepMode_Tree::BuildTree() { |
| 26 | auto& buffer = m_window.GetBuffer(); |
| 27 | |
| 28 | std::ostringstream strBuffer; |
| 29 | std::function<void(ZepTreeNode*, uint32_t indent)> fnVisit; |
| 30 | |
| 31 | fnVisit = [&](ZepTreeNode* pNode, uint32_t indent) { |
| 32 | for (uint32_t i = 0; i < indent; i++) { |
| 33 | strBuffer << " "; |
| 34 | } |
| 35 | |
| 36 | if (pNode->HasChildren()) { |
| 37 | strBuffer << (pNode->IsExpanded() ? "~ " : "+ "); |
| 38 | } else { |
| 39 | strBuffer << " "; |
| 40 | } |
| 41 | |
| 42 | strBuffer << pNode->GetName() << std::endl; |
| 43 | |
| 44 | if (pNode->IsExpanded()) { |
| 45 | for (auto& pChild : pNode->GetChildren()) { |
| 46 | fnVisit(pChild.get(), indent + 2); |
| 47 | } |
| 48 | } |
| 49 | }; |
| 50 | |
| 51 | if (m_spTree->GetRoot()->IsExpanded()) { |
| 52 | for (auto pChild : m_spTree->GetRoot()->GetChildren()) { |
| 53 | fnVisit(pChild.get(), 0); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | ChangeRecord tempRecord; |
| 58 | buffer.Clear(); |
| 59 | buffer.Insert(buffer.Begin(), strBuffer.str(), tempRecord); |
| 60 | } |
| 61 | |
| 62 | void ZepMode_Tree::Begin(ZepWindow* pWindow) { |
| 63 | ZepMode_Vim::Begin(pWindow); |
nothing calls this directly
no test coverage detected