From 183c97d8a8a0e864c4341976615673457e8e8335 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 8 Jun 2017 15:22:03 +0200 Subject: [PATCH] Give a 2 pixels space for markers around math objects This is necessary when markers are nested. Ideally this should only be done when there is risk of nesting. Fixes (part of?) bug #10688. --- src/mathed/MathRow.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp index 783e85ab54..b312e22e6f 100644 --- a/src/mathed/MathRow.cpp +++ b/src/mathed/MathRow.cpp @@ -49,8 +49,16 @@ namespace { int markerMargin(MathRow::Element const & e) { - return e.marker == InsetMath::MARKER - || e.marker == InsetMath::MARKER2; + switch(e.marker) { + case InsetMath::MARKER: + case InsetMath::MARKER2: + case InsetMath::BOX_MARKER: + return 2; + case InsetMath::NO_MARKER: + return 0; + } + // should not happen + return 0; } @@ -92,7 +100,7 @@ void drawMarkers(PainterInfo const & pi, MathRow::Element const & e, Dimension const dim = coords.getInsets().dim(e.inset); // the marker is before/after the inset. Necessary space has been reserved already. - int const l = x + e.before - markerMargin(e); + int const l = x + e.before - (markerMargin(e) > 0 ? 1 : 0); int const r = x + dim.width() - e.after; if (e.marker == InsetMath::BOX_MARKER) { -- 2.39.2