commit 542445d07d0b45aca66115a693b29fc07966d7f5
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Thu Nov 18 16:36:29 2021 +0100
When pasting text, keep line breaks when "parbreak is newline"
This is much easier for listings, ERT or Verbatim.
Fixes bug #8026.
---
src/Paragraph.cpp | 6 ++++++
src/Paragraph.h | 2 ++
src/Text3.cpp | 3 ++-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 6b960cd..a33d6d6 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -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) {
diff --git a/src/Paragraph.h b/src/Paragraph.h
index d6e4a76..01ccd25 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -239,6 +239,8 @@ public:
///
bool isPassThru() const;
///
+ bool parbreakIsNewline() const;
+ ///
bool isPartOfTextSequence() const;
///
pos_type size() const;
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 1623996..a87169b 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -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())
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs