commit 2a6f911bf3cf32928f176e6b1261bf23f5a7a8a1 Author: Pavel Sanda <sa...@lyx.org> Date: Sun Feb 16 17:28:43 2025 +0100
Fix spurious newlines in .lyx format. The superfluous newline is coming from the beginning of Font::lyxWriteChanges where it's uncoditionally written to ostream output even when no difference is actually find in this routine. https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg223616.html --- src/Font.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Font.cpp b/src/Font.cpp index 5fc47553fb..56466c825a 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -158,9 +158,9 @@ string const Font::latexSize() const /// Writes the changes from this font to orgfont in .lyx format in file void Font::lyxWriteChanges(Font const & orgfont, - ostream & os) const + ostream & ret_os) const { - os << "\n"; + ostringstream os; if (orgfont.fontInfo().family() != bits_.family()) os << "\\family " << LyXFamilyNames[bits_.family()] << "\n"; if (orgfont.fontInfo().series() != bits_.series()) @@ -219,6 +219,9 @@ void Font::lyxWriteChanges(Font const & orgfont, else os << "\\lang unknown\n"; } + + if (!os.str().empty()) + ret_os << "\n" << os.str(); } -- lyx-cvs mailing list lyx-cvs@lists.lyx.org https://lists.lyx.org/mailman/listinfo/lyx-cvs