MCPcopy Create free account
hub / github.com/Rezonality/zep / UpdateWindowState

Method UpdateWindowState

src/editor.cpp:451–505  ·  view source on GitHub ↗

Here we ensure that the editor is in a valid state, and cleanup Default buffers

Source from the content-addressed store, hash-verified

449
450// Here we ensure that the editor is in a valid state, and cleanup Default buffers
451void 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
507void ZepEditor::ResetCursorTimer()
508{

Callers

nothing calls this directly

Calls 10

backMethod · 0.80
GetActiveWindowMethod · 0.80
SetActiveWindowMethod · 0.80
HasFileFlagsMethod · 0.80
LayoutDirtyMethod · 0.80
DirtyLayoutMethod · 0.80
SetLayoutDirtyMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected