| 342 | } |
| 343 | |
| 344 | ZepWindow* ZepEditor::AddSearch() { |
| 345 | if (!GetActiveTabWindow()) { |
| 346 | return nullptr; |
| 347 | } |
| 348 | |
| 349 | static std::unordered_set<std::string> search_keywords = {}; |
| 350 | static std::unordered_set<std::string> search_identifiers = {}; |
| 351 | |
| 352 | auto pSearchBuffer = GetEmptyBuffer("Search", FileFlags::Locked | FileFlags::ReadOnly); |
| 353 | pSearchBuffer->SetBufferType(BufferType::Search); |
| 354 | pSearchBuffer->SetSyntax(std::make_shared<ZepSyntax>(*pSearchBuffer, search_keywords, search_identifiers, ZepSyntaxFlags::CaseInsensitive)); |
| 355 | |
| 356 | auto pActiveWindow = GetActiveTabWindow()->GetActiveWindow(); |
| 357 | bool hasGit = false; |
| 358 | auto searchPath = GetFileSystem().GetSearchRoot(pActiveWindow->GetBuffer().GetFilePath(), hasGit); |
| 359 | |
| 360 | auto pSearchWindow = GetActiveTabWindow()->AddWindow(pSearchBuffer, nullptr, RegionLayoutType::VBox); |
| 361 | pSearchWindow->SetWindowFlags(pSearchWindow->GetWindowFlags() | WindowFlags::Modal); |
| 362 | |
| 363 | auto pMode = std::make_shared<ZepMode_Search>(*this, *pActiveWindow, *pSearchWindow, searchPath); |
| 364 | pSearchBuffer->SetMode(pMode); |
| 365 | pMode->Begin(pSearchWindow); |
| 366 | return pSearchWindow; |
| 367 | } |
| 368 | |
| 369 | ZepTabWindow* ZepEditor::EnsureTab() { |
| 370 | if (m_tabWindows.empty()) { |
no test coverage detected