diff --git a/src/frontends/Clipboard.h b/src/frontends/Clipboard.h index 42ecd6c1a5..67ce307e52 100644 --- a/src/frontends/Clipboard.h +++ b/src/frontends/Clipboard.h @@ -56,6 +56,8 @@ public: /// (document contents, dialogs count as external here). virtual bool isInternal() const = 0; /// Is the clipboard empty? + /// \returns true if both the LyX and the plaintext versions of the + /// clipboard are empty. virtual bool empty() const = 0; }; diff --git a/src/frontends/qt4/GuiClipboard.C b/src/frontends/qt4/GuiClipboard.C index 03388b3c09..517676e800 100644 --- a/src/frontends/qt4/GuiClipboard.C +++ b/src/frontends/qt4/GuiClipboard.C @@ -116,7 +116,13 @@ bool GuiClipboard::isInternal() const bool GuiClipboard::empty() const { - return qApp->clipboard()->text(QClipboard::Clipboard).isEmpty(); + // We need to check both the plaintext and the LyX version of the + // clipboard. The plaintext version is empty if the LyX version + // contains only one inset, and the LyX version is empry if the + // clipboard does not come from LyX. + if (!qApp->clipboard()->text(QClipboard::Clipboard).isEmpty()) + return false; + return !hasLyXContents(); } } // namespace frontend