| 557 | } |
| 558 | |
| 559 | void 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 | |
| 586 | void ZepMode::Redo() |
| 587 | { |
nothing calls this directly
no test coverage detected