When pasting multiline plain text near the end of a kmemo, if the first line of (pasting)text is longer than remaining text in KMemo, the pasted content is split between the correct insertion point and the end of the content.
Reason is that TKMemoBlocks.InsertPlainText() calls InsertString() and then InsertParagraph() for each newline terminated string in the clipboard. But KMemoBlocks.InsertParagraph() relies on FSelectableLength to ensure its not at the end of content and FSelectableText is not updated after the InsertString() call. As a result, KMemo thinks the Index is beyond its own content length and puts the new Paragraph (and subsequent clipboard content) at end of its own content.
Solution is to call UpdateAttributes() after inserting the text, that updates FSelectableLength. Attached patch does this, run patch from the kcontrols/source directory.
kmemo_paste_text.zip Original report by David Bannon (Bitbucket: davidbannon, GitHub: davidbannon).
When pasting multiline plain text near the end of a kmemo, if the first line of (pasting)text is longer than remaining text in KMemo, the pasted content is split between the correct insertion point and the end of the content.
Reason is that TKMemoBlocks.InsertPlainText() calls InsertString() and then InsertParagraph() for each newline terminated string in the clipboard. But KMemoBlocks.InsertParagraph() relies on FSelectableLength to ensure its not at the end of content and FSelectableText is not updated after the InsertString() call. As a result, KMemo thinks the Index is beyond its own content length and puts the new Paragraph (and subsequent clipboard content) at end of its own content.
Solution is to call UpdateAttributes() after inserting the text, that updates FSelectableLength. Attached patch does this, run patch from the kcontrols/source directory.
Davo