sw/source/uibase/shells/basesh.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 0250d6c643f2866c4de7e3c943248ffda9205d05
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Jan 16 09:19:36 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Jan 16 09:28:06 2023 +0000

    sw, UpdateFieldContent: address a minor performance nit
    
    See
    
<https://gerrit.libreoffice.org/c/core/+/145459/1#message-fa0ede3525e35014c1f6c99455a96a69bc2a3601>,
    it's enough to start grouping undo/redo after we know that there is a
    relevant refmark under the cursor.
    
    Change-Id: I53e7e371768480d6b7e968c90bf8c5d9901013b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145555
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 44759890e695..363c37f9d580 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -913,16 +913,6 @@ void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& 
rWrtSh)
     uno::Sequence<beans::PropertyValue> aField;
     pField->GetValue() >>= aField;
 
-    SwDoc* pDoc = rWrtSh.GetDoc();
-    pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSBOOKMARK, nullptr);
-    rWrtSh.StartAction();
-    comphelper::ScopeGuard g(
-        [&rWrtSh]
-        {
-            rWrtSh.EndAction();
-            
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSBOOKMARK, nullptr);
-        });
-
     SwPosition& rCursor = *rWrtSh.GetCursor()->GetPoint();
     SwTextNode* pTextNode = rCursor.GetNode().GetTextNode();
     std::vector<SwTextAttr*> aAttrs
@@ -938,6 +928,16 @@ void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& 
rWrtSh)
         return;
     }
 
+    SwDoc* pDoc = rWrtSh.GetDoc();
+    pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSBOOKMARK, nullptr);
+    rWrtSh.StartAction();
+    comphelper::ScopeGuard g(
+        [&rWrtSh]
+        {
+            rWrtSh.EndAction();
+            
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSBOOKMARK, nullptr);
+        });
+
     comphelper::SequenceAsHashMap aMap(aField);
     auto aName = aMap["Name"].get<OUString>();
     rRefmark.GetRefName() = aName;

Reply via email to