From bd53ffcbefe4e7a22fc493b1916939bae5f9dc1d Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 9 Feb 2024 21:45:35 +1100 Subject: Implement API to read and write undo history from applications. --- src/Editor.cxx | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/Editor.cxx') diff --git a/src/Editor.cxx b/src/Editor.cxx index 2d7d07e22..b8ed636d3 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -6586,6 +6586,49 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { pdoc->EndUndoAction(); return 0; + case Message::GetUndoActions: + return pdoc->UndoActions(); + + case Message::SetUndoSavePoint: + pdoc->SetUndoSavePoint(static_cast(wParam)); + break; + + case Message::GetUndoSavePoint: + return pdoc->UndoSavePoint(); + + case Message::SetUndoCurrent: + pdoc->SetUndoCurrent(static_cast(wParam)); + break; + + case Message::GetUndoCurrent: + return pdoc->UndoCurrent(); + + case Message::SetUndoTentative: + pdoc->SetUndoTentative(static_cast(wParam)); + break; + + case Message::GetUndoTentative: + return pdoc->UndoTentative(); + + case Message::GetUndoActionType: + return pdoc->UndoActionType(static_cast(wParam)); + + case Message::GetUndoActionPosition: + return pdoc->UndoActionPosition(static_cast(wParam)); + + case Message::GetUndoActionText: { + std::string_view text = pdoc->UndoActionText(static_cast(wParam)); + return BytesResult(lParam, reinterpret_cast(text.data()), text.length()); + } + + case Message::PushUndoActionType: + pdoc->PushUndoActionType(static_cast(wParam), lParam); + break; + + case Message::ChangeLastUndoActionText: + pdoc->ChangeLastUndoActionText(wParam, CharPtrFromSPtr(lParam)); + break; + case Message::GetCaretPeriod: return caret.period; -- cgit v1.2.3