From cb2fc705104022913b3eb5bdf13198463ec7eae2 Mon Sep 17 00:00:00 2001 From: mark-sil <83427558+mark-sil@users.noreply.github.com> Date: Thu, 14 May 2026 15:29:33 -0400 Subject: [PATCH] LT-20857: Fixed a paste problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed the paste problem when the selection is a single paragraph. In the code a paragraph is indicated by a ā€˜\n’. Note: This fix is specific to a single paragraph selection. It does not add support for other complex selections. --- Src/views/VwSelection.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Src/views/VwSelection.cpp b/Src/views/VwSelection.cpp index e5eb3f1c17..9db32f0ccf 100644 --- a/Src/views/VwSelection.cpp +++ b/Src/views/VwSelection.cpp @@ -5584,8 +5584,18 @@ STDMETHODIMP VwTextSelection::ReplaceWithTsString(ITsString * ptss) qttpPara.Clear(); if (SameObject(qttpText, qttpPara)) + { qttpPara.Clear(); // Not a special paragraph property after all. - vpttpPara.Push(qttpPara); + + // If it is not the last character, or it is the last character + // and we have added others, then add it to vpttpPara. + // Otherwise, don't add it so the new text will be treated as if + // it doesn't have a newline (fix for LT-20857). + if (ichNext < cch || vpttpPara.Size() > 0) + vpttpPara.Push(qttpPara); + } + else + vpttpPara.Push(qttpPara); Assert(cNewlines == 0); } else