From: Enrico Forestieri Date: Thu, 6 Dec 2018 09:30:58 +0000 (+0100) Subject: Amend bd21aa9 X-Git-Tag: 2.3.2~1 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3beb38c92e81eae0c321ebfcdb857265d91f6a3c;p=features.git Amend bd21aa9 Check whether a line is actually blank rather than whether we are at the beginning of a line. (cherry picked from commit 976e0b79933e162070ef3d2973fb0c899f8bdf54) --- diff --git a/ANNOUNCE b/ANNOUNCE index 2b9171b2b1..f9f8e964a4 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -164,6 +164,8 @@ What's new - Fix loading order conflict with beamer-article and covington. +- Preserve a new paragraph after a float (bug 11398). + * USER INTERFACE diff --git a/src/Changes.cpp b/src/Changes.cpp index 5f8e3b21bf..6e3bf0fff7 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -428,7 +428,7 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams, // signature needed by \lyxsout to correctly strike out display math if (change.type == Change::DELETED && runparams.inDisplayMath && !dvipost) { - if (os.lastChar() == '\n') + if (os.blankLine()) str += from_ascii("\\\\\\noindent\n"); else str += from_ascii("\\\\\\\\\n"); diff --git a/src/texstream.h b/src/texstream.h index 2cfcd16da4..a14f84bf95 100644 --- a/src/texstream.h +++ b/src/texstream.h @@ -82,7 +82,7 @@ public: explicit otexstream(odocstream & os) : otexrowstream(os), canbreakline_(false), protectspace_(false), terminate_command_(false), - parbreak_(true), lastchar_(0) {} + parbreak_(true), blankline_(true), lastchar_(0) {} /// void put(char_type const & c); /// @@ -103,6 +103,7 @@ public: void lastChar(char_type const & c) { parbreak_ = (!canbreakline_ && c == '\n'); + blankline_ = ((!canbreakline_ && c == ' ') || c == '\n'); canbreakline_ = (c != '\n'); lastchar_ = c; } @@ -110,6 +111,8 @@ public: char_type lastChar() const { return lastchar_; } /// bool afterParbreak() const { return parbreak_; } + /// + bool blankLine() const { return blankline_; } private: /// bool canbreakline_; @@ -120,6 +123,8 @@ private: /// bool parbreak_; /// + bool blankline_; + /// char_type lastchar_; };