sw/inc/strings.hrc                 |    1 +
 sw/inc/swundo.hxx                  |    1 +
 sw/source/core/undo/undobj.cxx     |    3 +++
 sw/source/uibase/shells/basesh.cxx |    8 +++++---
 4 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 457af772f52e447ef4d2dd22c1eb4624e50e6df7
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Mar 22 20:01:50 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Mar 23 07:08:05 2023 +0000

    sw: fix undo comment of FN_UPDATE_FIELD
    
    It's an update and the name was not set. One has to dispatch
    .uno:UpdateField to see this in action, which does something if the
    cursor is inside an exiting reference mark.
    
    Change-Id: I1701c7c3ab0a395c2346d41fb517d13c9d9c5a3d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149350
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 57710c5a4524..38cdabf8ba01 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -441,6 +441,7 @@
 #define STR_INSBOOKMARK                         NC_("STR_INSBOOKMARK", "Insert 
bookmark: $1")
 #define STR_UPDATE_BOOKMARK                     NC_("STR_UPDATE_BOOKMARK", 
"Update bookmark: $1")
 #define STR_UPDATE_BOOKMARKS                    NC_("STR_UPDATE_BOOKMARKS", 
"Update bookmarks")
+#define STR_UPDATE_FIELD                        NC_("STR_UPDATE_FIELD", 
"Update field: $1")
 #define STR_SORT_TBL                            NC_("STR_SORT_TBL", "Sort 
table")
 #define STR_SORT_TXT                            NC_("STR_SORT_TXT", "Sort 
text")
 #define STR_INSTABLE_UNDO                       NC_("STR_INSTABLE_UNDO", 
"Insert table: $1$2$3")
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx
index 9728f96b93de..ff806d430330 100644
--- a/sw/inc/swundo.hxx
+++ b/sw/inc/swundo.hxx
@@ -173,6 +173,7 @@ enum class SwUndoId
     UPDATE_BOOKMARK,                   // 141
     UPDATE_BOOKMARKS,                  // 142
     DELETE_BOOKMARKS,                  // 143
+    UPDATE_FIELD,                      // 144
 };
 
 OUString GetUndoComment(SwUndoId eId);
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index af1388dec6ef..42f71be7c327 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -664,6 +664,9 @@ OUString GetUndoComment(SwUndoId eId)
         case SwUndoId::DELETE_BOOKMARKS:
             pId = STR_DELETE_BOOKMARKS;
             break;
+        case SwUndoId::UPDATE_FIELD:
+            pId = STR_UPDATE_FIELD;
+            break;
     }
 
     assert(pId);
diff --git a/sw/source/uibase/shells/basesh.cxx 
b/sw/source/uibase/shells/basesh.cxx
index 5e5d07565b5d..61567a64cff1 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -929,13 +929,15 @@ void UpdateFieldContent(SfxRequest& rReq, SwWrtShell& 
rWrtSh)
     }
 
     SwDoc* pDoc = rWrtSh.GetDoc();
-    pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSBOOKMARK, nullptr);
+    SwRewriter aRewriter;
+    aRewriter.AddRule(UndoArg1, rRefmark.GetRefName());
+    pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_FIELD, &aRewriter);
     rWrtSh.StartAction();
     comphelper::ScopeGuard g(
-        [&rWrtSh]
+        [&rWrtSh, &aRewriter]
         {
             rWrtSh.EndAction();
-            
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSBOOKMARK, nullptr);
+            
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_FIELD, 
&aRewriter);
         });
 
     comphelper::SequenceAsHashMap aMap(aField);

Reply via email to