When pasting text, keep line breaks when "parbreak is newline"

This is much easier for listings, ERT or Verbatim.

Fixes bug #8026.
This commit is contained in:
Jean-Marc Lasgouttes 2021-11-18 16:36:29 +01:00
parent 51e92a5a97
commit 542445d07d
3 changed files with 10 additions and 1 deletions

View File

@ -2269,6 +2269,12 @@ bool Paragraph::isPassThru() const
}
bool Paragraph::parbreakIsNewline() const
{
return inInset().getLayout().parbreakIsNewline() || d->layout_->parbreak_is_newline;
}
bool Paragraph::isPartOfTextSequence() const
{
for (pos_type i = 0; i < size(); ++i) {

View File

@ -239,6 +239,8 @@ public:
///
bool isPassThru() const;
///
bool parbreakIsNewline() const;
///
bool isPartOfTextSequence() const;
///
pos_type size() const;

View File

@ -1521,7 +1521,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
pasteFromStack(cur, bv->buffer().errorList("Paste"), 0);
else if (theClipboard().hasTextContents()) {
if (pasteClipboardText(cur, bv->buffer().errorList("Paste"),
true, Clipboard::AnyTextType))
!cur.paragraph().parbreakIsNewline(),
Clipboard::AnyTextType))
tryGraphics = false;
}
if (tryGraphics && theClipboard().hasGraphicsContents())