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

Method AddCommand

src/mode.cpp:559–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559void ZepMode::AddCommand(std::shared_ptr<ZepCommand> spCmd)
560{
561 if (m_pCurrentWindow == nullptr)
562 {
563 return;
564 }
565
566 if (GetCurrentWindow()->GetBuffer().HasFileFlags(FileFlags::Locked))
567 {
568 // Ignore commands on buffers because we are view only,
569 // and all commands currently modify the buffer!
570 return;
571 }
572
573 spCmd->Redo();
574 m_undoStack.push(spCmd);
575
576 // Can't redo anything beyond this point
577 std::stack<std::shared_ptr<ZepCommand>> empty;
578 m_redoStack.swap(empty);
579
580 if (spCmd->GetCursorAfter().Valid())
581 {
582 GetCurrentWindow()->SetBufferCursor(spCmd->GetCursorAfter());
583 }
584}
585
586void ZepMode::Redo()
587{

Callers

nothing calls this directly

Calls 6

HasFileFlagsMethod · 0.80
ValidMethod · 0.80
GetCursorAfterMethod · 0.80
SetBufferCursorMethod · 0.80
RedoMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected