From 9ffacb341dd7f63e31782e8c8f81be2c2074dd08 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 6 Nov 2024 18:26:14 +0100 Subject: [PATCH] Fix spacing problems in previews with math macros (#13120) This occurs on the legacy path when no cropping tools are available. --- src/mathed/InsetMathHull.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index bf04577e4f..de20771e38 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -817,8 +817,11 @@ void InsetMathHull::usedMacros(MathData const & md, DocIterator const & pos, if (data) { odocstringstream macro_def; data->write(macro_def, true); - macro_def << endl; - defs.insert(macro_def.str()); + // Empty lines will generate full rows + // with legacy preview and tightpage (#13120). + // So remove all preceding and trailing line breaks + // and re-add one at the end of the snippet + defs.insert(trim(macro_def.str(), "\n") + "\n"); asArray(data->definition(), ar); } usedMacros(ar, pos, macros, defs);