From f02a98497dd8b8917c6879c9e42b996aa4fb9901 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Fri, 10 Mar 2006 14:51:28 +0000 Subject: [PATCH] fix bug 1955 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13322 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 5 +++++ src/frontends/qt2/QWorkArea.C | 15 +++++++++++++++ src/frontends/qt4/ChangeLog | 5 +++++ src/frontends/qt4/QWorkArea.C | 16 ++++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 30ffae7e76..8894d0e635 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,8 @@ +2006-03-10 Georg Baum + + * QWorkArea.C (getClipboard): convert MAC to UNIX line endings on OSX + * QWorkArea.C (putClipboard): convert UNIX to MAC line endings on OSX + 2006-02-15 Jürgen Spitzmüller * QCitationDialog.C (up, down): get rid of the iterator. diff --git a/src/frontends/qt2/QWorkArea.C b/src/frontends/qt2/QWorkArea.C index 6fcd0b6172..0dbefef5e3 100644 --- a/src/frontends/qt2/QWorkArea.C +++ b/src/frontends/qt2/QWorkArea.C @@ -35,6 +35,11 @@ #include #endif +#ifdef Q_OS_MAC +#include + +using lyx::support::subst; +#endif using std::endl; using std::string; @@ -201,7 +206,12 @@ string const QWorkArea::getClipboard() const QString str = QApplication::clipboard()->text(); if (str.isNull()) return string(); +#ifdef Q_OS_MAC + // The MAC clipboard uses \r for lineendings, and we use \n + return subst(fromqstr(str), '\r', '\n'); +#else return fromqstr(str); +#endif } @@ -210,7 +220,12 @@ void QWorkArea::putClipboard(string const & str) const #if QT_VERSION >= 300 QApplication::clipboard()->setSelectionMode(true); #endif +#ifdef Q_OS_MAC + // The MAC clipboard uses \r for lineendings, and we use \n + QApplication::clipboard()->setText(toqstr(subst(str, '\n', '\r'))); +#else QApplication::clipboard()->setText(toqstr(str)); +#endif } diff --git a/src/frontends/qt4/ChangeLog b/src/frontends/qt4/ChangeLog index 8baa0337c1..0cd7e9f440 100644 --- a/src/frontends/qt4/ChangeLog +++ b/src/frontends/qt4/ChangeLog @@ -1,3 +1,8 @@ +2006-03-10 Georg Baum + + * QWorkArea.C (getClipboard): convert MAC to UNIX line endings on OSX + * QWorkArea.C (putClipboard): convert UNIX to MAC line endings on OSX + 2006-03-05 Lars Gullik Bjønnes * add svn:ignore diff --git a/src/frontends/qt4/QWorkArea.C b/src/frontends/qt4/QWorkArea.C index 25d220a2ef..ded221a92b 100644 --- a/src/frontends/qt4/QWorkArea.C +++ b/src/frontends/qt4/QWorkArea.C @@ -43,6 +43,11 @@ #include #endif +#ifdef Q_OS_MAC +#include + +using lyx::support::subst; +#endif using std::endl; using std::string; @@ -350,13 +355,24 @@ string const QWorkArea::getClipboard() const lyxerr[Debug::ACTION] << "getClipboard: " << (const char*) str << endl; if (str.isNull()) return string(); +#ifdef Q_OS_MAC + // The MAC clipboard uses \r for lineendings, and we use \n + return subst(fromqstr(str), '\r', '\n'); +#else return fromqstr(str); +#endif } void QWorkArea::putClipboard(string const & str) const { +#ifdef Q_OS_MAC + // The MAC clipboard uses \r for lineendings, and we use \n + QApplication::clipboard()->setText(toqstr(subst(str, '\n', '\r')), + QClipboard::Selection); +#else QApplication::clipboard()->setText(toqstr(str), QClipboard::Selection); +#endif lyxerr[Debug::ACTION] << "putClipboard: " << str << endl; } -- 2.39.5