summaryrefslogtreecommitdiff
path: root/sw/source/core/doc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-11-08 08:27:52 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-11-08 09:20:45 +0100
commit6680e51716e383c68bb1ec9cc0a05d698d3b6a3d (patch)
tree23340a5bd1e0c990aede7f725502b41df25a0641 /sw/source/core/doc
parent033aea780cc8315979b6de2692f5f7aeb6a0e99b (diff)
sw: try grouping undo actions of IME-edited text
This is a problem since commit e7760d428bc82ccfcae14f1907b78f9f1013b88c (Fix tdf#87500 - Freeze with English/Japanese mixture undo., 2015-09-08), that started not grouping IME-edited text completely. This means that in case you go via SwEditWin::Command() instead of SwEditWin::KeyInput() to type a 4 characters word, then it'll create 4 undo actions. Fix the problem by tracking who was the last caller of sw::DocumentContentOperationsManager::InsertString(), so we can only disable grouping switching between IME and non-IME, and we can have grouping for a series of IME input. Change-Id: I31bd02db4fe653ab63e41a77c75b8bebfc749ff1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124766 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/doc')
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx10
-rw-r--r--sw/source/core/doc/extinput.cxx12
2 files changed, 20 insertions, 2 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 75cdb398ba7b..0b2b7b8647f6 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2902,6 +2902,16 @@ bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUS
return true;
}
+void DocumentContentOperationsManager::SetIME(bool bIME)
+{
+ m_bIME = bIME;
+}
+
+bool DocumentContentOperationsManager::GetIME() const
+{
+ return m_bIME;
+}
+
void DocumentContentOperationsManager::TransliterateText(
const SwPaM& rPaM,
utl::TransliterationWrapper& rTrans )
diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index e3b2767b6af2..d366a2f852a2 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -61,7 +61,12 @@ SwExtTextInput::~SwExtTextInput()
// Prevent IME edited text being grouped with non-IME edited text.
bool bKeepGroupUndo = rDoc.GetIDocumentUndoRedo().DoesGroupUndo();
- rDoc.GetIDocumentUndoRedo().DoGroupUndo(false);
+ bool bWasIME = rDoc.GetIDocumentUndoRedo().GetUndoActionCount() == 0 || rDoc.getIDocumentContentOperations().GetIME();
+ if (!bWasIME)
+ {
+ rDoc.GetIDocumentUndoRedo().DoGroupUndo(false);
+ }
+ rDoc.getIDocumentContentOperations().SetIME(true);
if( nEndCnt < nSttCnt )
{
std::swap(nSttCnt, nEndCnt);
@@ -119,7 +124,10 @@ SwExtTextInput::~SwExtTextInput()
pTNd->EraseText( rIdx, nLenghtOfOldString );
}
- rDoc.GetIDocumentUndoRedo().DoGroupUndo(bKeepGroupUndo);
+ if (!bWasIME)
+ {
+ rDoc.GetIDocumentUndoRedo().DoGroupUndo(bKeepGroupUndo);
+ }
if (m_eInputLanguage == LANGUAGE_DONTKNOW)
return;