summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@libreoffice.org>2013-10-07 21:09:26 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-10-17 15:58:25 +0000
commita55ba57c0ad4d5c2d8f49d4d57d00e7e05380351 (patch)
tree2ca8bc191b8c81aa310c2ba3203f0186142899e4
parentdd7c746c184de38104aa1f057886d7c538e2e0b2 (diff)
fdo#70143: fix SwDoc::ReplaceRangeImpl()
Fix fdo#70143 by reporting swaping of positions (regression from 6b08fe833186a04f9aef698a540d3a7493ac4519, which changed SwUndoReplace::Impl::SetEnd to use the wrongly set end position in rPam) Change-Id: I14c6f58bc5c1418c69eb565d42f1829856eed58c (cherry picked from commit 9685d20f2a0526a4c454cea1bd947eccbaeefa84) Fixes regex replace of "$" with nothing (to delete line breaks). Change-Id: If7ec1e5f524f7bb308a2949ace16cb8aa6989106 (cherry picked from commit f011a5c5071ed4a60f0ee7117608b72cecbb958d) Reviewed-on: https://gerrit.libreoffice.org/6175 Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org> Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit ca83560f3079289df88dd7df7c00917efbd72dc0) Reviewed-on: https://gerrit.libreoffice.org/6225
-rw-r--r--sw/source/core/doc/docedt.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index f169ae5a5172..b0794e66d1ef 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -2442,17 +2442,23 @@ SetRedlineMode( eOld );
}
}
- *rPam.GetMark() = *aDelPam.GetMark();
-
+ *rPam.GetPoint() = *aDelPam.GetMark();
++aPtNd;
rPam.GetMark()->nNode = aPtNd;
rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetCntntNode(),
nPtCnt );
- if (bJoinTxt && !bJoinPrev)
+ if (bJoinTxt)
{
+ assert(rPam.GetPoint() == rPam.End());
+ // move so that SetEnd remembers position after sw_JoinText
rPam.Move(fnMoveBackward);
}
+ else if (aDelPam.GetPoint() == pStt) // backward selection?
+ {
+ assert(*rPam.GetMark() <= *rPam.GetPoint());
+ rPam.Exchange(); // swap so that rPam is backwards
+ }
if( pUndoRpl )
{