summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-01-19 21:32:21 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-01-24 11:49:14 +0100
commitb4de5e9f55ed9a9d1d161bab5e96a66c88fc1236 (patch)
tree646421974b4fe992209d45b56aa29f120afced83
parenteae887b628fde6b73d354b4788c8303db9c36aac (diff)
Resolves: tdf#139974 Do not munge character after forced line break
A classical +-1 error.. Change-Id: I8b6bc0843fa585d8a710c74f757098ab9c6f823d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128637 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 2cfa04cbf03fe5c2ce32a7384082cdc5de5a4785) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128541 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> (cherry picked from commit 2b8946e52fa170c7df4bf71440e2ed63474db28f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128668 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--editeng/source/editeng/impedit2.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index cbbfddff51c7..53748a9d4ce9 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2728,8 +2728,10 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const OUStrin
if (nChars > MAXCHARSINPARA)
{
sal_Int32 nMaxNewChars = std::max<sal_Int32>(0, MAXCHARSINPARA - nExistingChars);
- nEnd -= ( aLine.getLength() - nMaxNewChars ); // Then the characters end up in the next paragraph.
- aLine = aLine.copy( 0, nMaxNewChars ); // Delete the Rest...
+ // Remaining characters end up in the next paragraph. Note that
+ // new nStart will be nEnd+1 below so decrement by one more.
+ nEnd -= (aLine.getLength() - nMaxNewChars + 1);
+ aLine = aLine.copy( 0, nMaxNewChars ); // Delete the Rest...
}
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo(std::make_unique<EditUndoInsertChars>(pEditEngine, CreateEPaM(aPaM), aLine));