Here we ensure that the editor is in a valid state, and cleanup Default buffers
| 449 | |
| 450 | // Here we ensure that the editor is in a valid state, and cleanup Default buffers |
| 451 | void ZepEditor::UpdateWindowState() |
| 452 | { |
| 453 | // If there is no active tab window, and we have one, set it. |
| 454 | if (!m_pActiveTabWindow) |
| 455 | { |
| 456 | if (!m_tabWindows.empty()) |
| 457 | { |
| 458 | SetCurrentTabWindow(m_tabWindows.back()); |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | // If the tab window doesn't contain an active window, and there is one, set it |
| 463 | if (m_pActiveTabWindow && !m_pActiveTabWindow->GetActiveWindow()) |
| 464 | { |
| 465 | if (!m_pActiveTabWindow->GetWindows().empty()) |
| 466 | { |
| 467 | m_pActiveTabWindow->SetActiveWindow(m_pActiveTabWindow->GetWindows().back()); |
| 468 | m_bRegionsChanged = true; |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | // Clean up any default buffers |
| 473 | std::vector<ZepBuffer*> victims; |
| 474 | for (auto& buffer : m_buffers) |
| 475 | { |
| 476 | if (!buffer->HasFileFlags(FileFlags::DefaultBuffer) || buffer->HasFileFlags(FileFlags::Dirty)) |
| 477 | { |
| 478 | continue; |
| 479 | } |
| 480 | |
| 481 | auto windows = FindBufferWindows(buffer.get()); |
| 482 | if (windows.empty()) |
| 483 | { |
| 484 | victims.push_back(buffer.get()); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | for (auto& victim : victims) |
| 489 | { |
| 490 | RemoveBuffer(victim); |
| 491 | } |
| 492 | |
| 493 | // If the display says we need a layout update, force it on all the windows |
| 494 | if (GetDisplay().LayoutDirty()) |
| 495 | { |
| 496 | for (auto& tabWindow : GetTabWindows()) |
| 497 | { |
| 498 | for (auto& window : tabWindow->GetWindows()) |
| 499 | { |
| 500 | window->DirtyLayout(); |
| 501 | } |
| 502 | } |
| 503 | GetDisplay().SetLayoutDirty(false); |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | void ZepEditor::ResetCursorTimer() |
| 508 | { |
nothing calls this directly
no test coverage detected