summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-06-19 16:32:19 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-06-19 19:50:41 +0200
commit398ba26077f9029bdf6f7378bfc9ce8376b6f02d (patch)
tree43786abc6480e58ef8e871a8c26e1953bac8fd73
parentbbcede94b952967098875f3ed1149f585c7b4cbd (diff)
tdf#127635 sw_redlinehide: put point at the end of deletion
SwWrtShell::Insert() is called with a selection, so it first calls DeleteAndJoin() to get rid of the selection. With redlining enabled, this leaves the cursor as it was before, so if the point was at the start it still is at the start, so the following Insert will insert at the start of the selection. But then AutoCorrect wants to do things and it uses TextFrameIndex and ViewToModelPos and gets a result at the end of the delete redline, while the cursor remains at the start of the delete redline. Avoid this by swapping the selection after DeleteAndJoin() (and also DeleteRange() for consistency) so that insertion happens at end of redline (swap "above" DoWithBreaks because it creates temporary PaMs). (regression from sw_redlinehide) Change-Id: Ib5b0475f610c2ce426e9202e9d325dd0cc451d5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96743 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index ebb7c988f04a..ea1aa8b001be 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2010,6 +2010,11 @@ void DocumentContentOperationsManager::DeleteRange( SwPaM & rPam )
{
lcl_DoWithBreaks( *this, rPam, &DocumentContentOperationsManager::DeleteRangeImpl );
+ if (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
+ {
+ rPam.Normalize(false); // tdf#127635 put point at the end of deletion
+ }
+
if (!m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline()
&& !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty())
{
@@ -2181,10 +2186,17 @@ bool DocumentContentOperationsManager::DeleteAndJoin( SwPaM & rPam,
if ( lcl_StrLenOverflow( rPam ) )
return false;
- return lcl_DoWithBreaks( *this, rPam, (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
+ bool const ret = lcl_DoWithBreaks( *this, rPam, (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
? &DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl
: &DocumentContentOperationsManager::DeleteAndJoinImpl,
bForceJoinNext );
+
+ if (m_rDoc.getIDocumentRedlineAccess().IsRedlineOn())
+ {
+ rPam.Normalize(false); // tdf#127635 put point at the end of deletion
+ }
+
+ return ret;
}
// It seems that this is mostly used by SwDoc internals; the only