summaryrefslogtreecommitdiff
path: root/sw/source/uibase/wrtsh/delete.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/wrtsh/delete.cxx')
-rw-r--r--sw/source/uibase/wrtsh/delete.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx
index cbb3fad91b69..4a2420ad7b84 100644
--- a/sw/source/uibase/wrtsh/delete.cxx
+++ b/sw/source/uibase/wrtsh/delete.cxx
@@ -239,10 +239,13 @@ bool SwWrtShell::DelLeft()
const SwPosition* pCurPos = GetCursor()->GetPoint();
SwPosition aPrevChar(*pCurPos);
--aPrevChar.nContent;
- sw::mark::IFieldmark* pFm = getIDocumentMarkAccess()->getFieldmarkFor(aPrevChar);
+ sw::mark::IFieldmark* pFm = getIDocumentMarkAccess()->getFieldmarkAt(aPrevChar);
if (pFm && pFm->GetMarkEnd() == *pCurPos)
{
+ mxDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
+ IDocumentMarkAccess::DeleteFieldmarkCommand(*pFm);
getIDocumentMarkAccess()->deleteMark(pFm);
+ mxDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
return true;
}
@@ -375,10 +378,13 @@ bool SwWrtShell::DelRight()
{
// If we are just ahead of a fieldmark, then remove it completely
- sw::mark::IFieldmark* pFm = GetCurrentFieldmark();
+ sw::mark::IFieldmark *const pFm = getIDocumentMarkAccess()->getFieldmarkAt(*GetCursor()->GetPoint());
if (pFm && pFm->GetMarkStart() == *GetCursor()->GetPoint())
{
+ mxDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
+ IDocumentMarkAccess::DeleteFieldmarkCommand(*pFm);
getIDocumentMarkAccess()->deleteMark(pFm);
+ mxDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
bRet = true;
break;
}