Editor: avoid duplicated line endings inbetween multiple cursors

Change-Id: Ia1721837efef47d570faa4e393b6b0b372944735
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2022-01-05 13:53:04 +01:00
parent eabfc443a7
commit 28e0a957c5

View File

@@ -132,8 +132,11 @@ QString MultiTextCursor::selectedText() const
const QString &cursorText = cursor.selectedText(); const QString &cursorText = cursor.selectedText();
if (cursorText.isEmpty()) if (cursorText.isEmpty())
continue; continue;
if (!text.isEmpty()) if (!text.isEmpty()) {
if (text.endsWith(QChar::ParagraphSeparator))
text.chop(1);
text.append('\n'); text.append('\n');
}
text.append(cursorText); text.append(cursorText);
} }
return text; return text;