From: Manuel Nickschas Date: Fri, 20 Feb 2009 08:31:41 +0000 (+0100) Subject: Chop linefeed from a single line selection X-Git-Tag: 0.5-rc1~349 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=830076bb8c321ee7866ffd430062282e7fe50afb 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). --- 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);