[Libreoffice-commits] core.git: sw/source
Justin Luth
justin_luth at sil.org
Fri Oct 2 03:47:44 PDT 2015
sw/source/uibase/wrtsh/wrtsh1.cxx | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
New commits:
commit 329e6f1a033dc45e9d9f7a50e3237bb65618ed3f
Author: Justin Luth <justin_luth at sil.org>
Date: Thu Oct 1 10:57:33 2015 +0300
tdf#88128 fix unevaluated undo variable: autocorrect
When replacing a selection with an autocorrect character
(like space, *, _) in Writer, the undo/redo remark
was "Insert $1" on Linux/Mac.
Change-Id: I2e7be035ec1cc107458cc30c14174a22fa31c075
Reviewed-on: https://gerrit.libreoffice.org/19069
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 719e237..249321e 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1588,12 +1588,27 @@ void SwWrtShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar )
if(CanInsert())
{
bool bStarted = false;
+ SwRewriter aRewriter;
+
if(HasSelection())
{
// Only parenthese here, because the regular insert
// is already clipped to the editshell
StartAllAction();
- StartUndo(UNDO_INSERT);
+
+ OUString aTmpStr1;
+ aTmpStr1 += SW_RES(STR_START_QUOTE);
+ aTmpStr1 += GetSelText();
+ aTmpStr1 += SW_RES(STR_END_QUOTE);
+ OUString aTmpStr3;
+ aTmpStr3 += SW_RES(STR_START_QUOTE);
+ aTmpStr3 += OUString(cChar);
+ aTmpStr3 += SW_RES(STR_END_QUOTE);
+ aRewriter.AddRule( UndoArg1, aTmpStr1 );
+ aRewriter.AddRule( UndoArg2, SW_RES(STR_YIELDS) );
+ aRewriter.AddRule( UndoArg3, aTmpStr3 );
+
+ StartUndo( UNDO_REPLACE, &aRewriter );
bStarted = true;
DelRight();
}
@@ -1602,7 +1617,7 @@ void SwWrtShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar )
if(bStarted)
{
EndAllAction();
- EndUndo(UNDO_INSERT);
+ EndUndo( UNDO_REPLACE, &aRewriter );
}
}
}
More information about the Libreoffice-commits
mailing list