commit 4f81bc9340c045aed9262c7748ee1b238e4de5b8
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Mon Jul 14 23:24:48 2025 +0200
Simplify handling of extrawidth in redoInset()
Since the 'changed' return value is not used, it makes more sense to
return extrawidth instead of passing it by reference.
No change intended.
---
src/TextMetrics.cpp | 11 ++++-------
src/TextMetrics.h | 3 ++-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 8d830da562..2f4ba0cc06 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1097,7 +1097,7 @@ bool needsRowBreak(int f1, int f2)
}
-bool TextMetrics::redoInset(Row::Element & elt, DocIterator & parPos, int w,
int & extrawidth) const
+int TextMetrics::redoInset(Row::Element & elt, DocIterator & parPos, int w)
const
{
Buffer const & buffer = bv_->buffer();
Font const bufferfont = buffer.params().getFont();
@@ -1116,7 +1116,7 @@ bool TextMetrics::redoInset(Row::Element & elt,
DocIterator & parPos, int w, int
MetricsInfo mi(bv_, font.fontInfo(), w, mc, elt.pos == 0, tight_);
mi.base.outer_font = displayFont(parPos.pit(), elt.pos).fontInfo();
elt.inset->metrics(mi, elt.dim);
- bool const changed = bv_->coordCache().insets().add(elt.inset, elt.dim);
+ bv_->coordCache().insets().add(elt.inset, elt.dim);
/* FIXME: This is a hack. This allows InsetMathHull to state that
* it needs some elbow room beyond its width, in order to fit the
* numbering and/or the left margin (with left alignment), which
@@ -1129,9 +1129,7 @@ bool TextMetrics::redoInset(Row::Element & elt,
DocIterator & parPos, int w, int
*
* See ticket #12320 for details.
*/
- extrawidth = mi.extrawidth;
-
- return changed;
+ return mi.extrawidth;
}
@@ -1234,8 +1232,7 @@ Rows TextMetrics::breakParagraph(Row const & bigrow) const
}
int const w = max_width_ - leftMargin(pit, elt.pos)
- rightMargin(pit) - eop;
- int extrawidth = 0;
- redoInset(elt, parPos, w, extrawidth);
+ int const extrawidth = redoInset(elt, parPos, w);
// For now only hull inset sets this, and it is alone
on its row
if (elt.dim.wid < max_width_ || tight_)
rb.dim().wid += extrawidth;
diff --git a/src/TextMetrics.h b/src/TextMetrics.h
index b8a1d9cf8f..ea400ca5a7 100644
--- a/src/TextMetrics.h
+++ b/src/TextMetrics.h
@@ -177,7 +177,8 @@ private:
Row tokenizeParagraph(pit_type pit) const;
// Compute metrics of inset element
- bool redoInset(Row::Element & elt, DocIterator & parPos, int w, int &
extrawidth) const;
+ // Returns the extra width that can be necessary for things like
InsetMathHull
+ int redoInset(Row::Element & elt, DocIterator & parPos, int w) const;
// Break the row produced by tokenizeParagraph() into a list of rows.
Rows breakParagraph(Row const & row) const;
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs