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 20:50:58 +0200
commit92dbbf840c1da7628bcdd9e8f67375efc2a2fa14 (patch)
tree2dcb2e1be891b27cd5619478678d9b6eba3fe464
parent461e9f2ad21046526c6644136f0abda91b0e4798 (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> (cherry picked from commit 398ba26077f9029bdf6f7378bfc9ce8376b6f02d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96704
-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 dc262426ff1e..6d048e248c3c 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2008,6 +2008,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())
{
@@ -2179,10 +2184,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