[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa sw/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 16 20:38:04 UTC 2020
sw/qa/extras/uiwriter/uiwriter2.cxx | 3 ++-
sw/source/core/text/redlnitr.cxx | 29 +++++++++++++++++++++++++++--
2 files changed, 29 insertions(+), 3 deletions(-)
New commits:
commit 6585f250d13fa27c2b3a5faf28d2cdab882ce323
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Tue Dec 15 11:50:53 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Wed Dec 16 21:37:30 2020 +0100
tdf#138847 sw ChangesInMargin: show all characters in margin
deleted by pressing backspace or delete, not only the first
character from the deleted character sequence.
Regression from commit 469f472fb31c4ef1a57f8ec54ba750c1332feec2
(tdf#138479 tdf#137769 sw ChangesInMargin: fix Undo in paragraphs).
Change-Id: I0027cc0da02df8bccba2d957d4cc0407f34ba014
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107745
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 8bd229c4e42e92545db11832b29bf97540707c32)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107797
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index cb33dc0ac5b3..c3d4d71d6b5c 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -2069,7 +2069,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137771)
assertXPath(pXmlDoc, "/metafile/push/push/push/line", 13);
// This was the content of the next <text> (missing deletion on margin)
- assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[16]/text", " s");
+ // or only the first character of the deleted character sequence
+ assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[16]/text", " saved.");
// this would crash due to bad redline range
for (int i = 0; i < 6; ++i)
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 3a6a2749f8a4..2e3d1f55a06e 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -956,11 +956,14 @@ bool SwRedlineItr::CheckLine(
SwPosition const start(*m_rDoc.GetNodes()[nStartNode]->GetContentNode(), nChkStart);
SwPosition const end(*m_rDoc.GetNodes()[nEndNode]->GetContentNode(), nChkEnd);
+ SwRangeRedline const* pPrevRedline = nullptr;
+ bool isBreak(false);
for (m_nAct = m_nFirst; m_nAct < m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++m_nAct)
{
SwRangeRedline const*const pRedline(
m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ m_nAct ] );
- bool isBreak(false);
+ // collect text of the hidden redlines at the end of the line
+ bool isExtendText(false);
switch (ComparePosition(*pRedline->Start(), *pRedline->End(), start, end))
{
case SwComparePosition::Behind:
@@ -983,13 +986,35 @@ bool SwRedlineItr::CheckLine(
if (rRedlineText.isEmpty() && pRedline->GetType() == RedlineType::Delete)
{
rRedlineText = const_cast<SwRangeRedline*>(pRedline)->GetDescr(/*bSimplified=*/true);
+ pPrevRedline = pRedline;
+ isExtendText = true;
+ }
+ // join the text of the next short delete redlines in the same position
+ // i.e. characters deleted by pressing backspace or delete
+ else if (pPrevRedline && pRedline->GetType() == RedlineType::Delete &&
+ *pRedline->Start() == *pPrevRedline->Start() && *pRedline->End() == *pPrevRedline->End() )
+ {
+ OUString sExtendText(const_cast<SwRangeRedline*>(pRedline)->GetDescr(/*bSimplified=*/true));
+ if (!sExtendText.isEmpty())
+ {
+ if (rRedlineText.getLength() < 12)
+ {
+ // TODO: remove extra space from GetDescr(true),
+ // but show deletion of paragraph or line break
+ rRedlineText = rRedlineText +
+ const_cast<SwRangeRedline*>(pRedline)->GetDescr(/*bSimplified=*/true).subView(1);
+ }
+ else
+ rRedlineText = OUString::Concat(rRedlineText.subView(0, rRedlineText.getLength() - 3)) + "...";
+ }
+ isExtendText = true;
}
break;
}
case SwComparePosition::Before:
break; // -Werror=switch
}
- if (isBreak)
+ if (isBreak && !isExtendText)
{
break;
}
More information about the Libreoffice-commits
mailing list