From 830076bb8c321ee7866ffd430062282e7fe50afb Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Fri, 20 Feb 2009 09:31:41 +0100 Subject: [PATCH] Chop linefeed from a single line selection This will chop a trailing linefeed for a single selected line, so you can paste it without sending it. Note that the behavior for multi-line selecions is still the same (you'd be pasting all but the last line in that case, which doesn't make much sense). --- src/qtui/chatscene.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index 4fdf92a0..2cb90ea9 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -708,7 +708,12 @@ void ChatScene::selectionToClipboard(QClipboard::Mode mode) { stringToClipboard(selection(), mode); } -void ChatScene::stringToClipboard(const QString &str, QClipboard::Mode mode) { +void ChatScene::stringToClipboard(const QString &str_, QClipboard::Mode mode) { + QString str = str_; + // remove trailing linefeeds + if(str.endsWith('\n')) + str.chop(1); + switch(mode) { case QClipboard::Clipboard: QApplication::clipboard()->setText(str); -- 2.20.1