]> git.lyx.org Git - features.git/commitdiff
Fixup da2696cc: do not clear useful information from row
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 23 May 2019 08:26:08 +0000 (10:26 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:30 +0000 (15:48 +0200)
Ensure before calling breakRow that the row is empty.

Remove Row::clear(), which has unnatural semantics.

Fixes bug #11396.

src/Row.h
src/TextMetrics.cpp

index e4a8e689b6a72bfefd8a672127a50bce48fe2a9b..d210174ef9460b269433dc9ac1c88fc2d7cc318e 100644 (file)
--- a/src/Row.h
+++ b/src/Row.h
@@ -261,8 +261,6 @@ public:
        Element const & back() const { return elements_.back(); }
        /// remove last element
        void pop_back();
-       /// remove all row elements
-       void clear() { *this = Row(); }
        /**
         * if row width is too large, remove all elements after last
         * separator and update endpos if necessary. If all that
index 6f195a602245e51790334845c208f4e3b70a05fc..fc610ad854b3370527c61bb76839d46b29355d0f 100644 (file)
@@ -524,10 +524,11 @@ bool TextMetrics::redoParagraph(pit_type const pit, bool const align_rows)
        do {
                if (row_index == pm.rows().size())
                        pm.rows().push_back(Row());
+               else
+                       pm.rows()[row_index] = Row();
                Row & row = pm.rows()[row_index];
                row.pit(pit);
                row.pos(first);
-               row.pit(pit);
                need_new_row = breakRow(row, right_margin);
                setRowHeight(row);
                row.changed(true);
@@ -881,6 +882,7 @@ private:
  */
 bool TextMetrics::breakRow(Row & row, int const right_margin) const
 {
+       LATTEST(row.empty());
        Paragraph const & par = text_->getPar(row.pit());
        pos_type const end = par.size();
        pos_type const pos = row.pos();
@@ -888,7 +890,6 @@ bool TextMetrics::breakRow(Row & row, int const right_margin) const
        bool const is_rtl = text_->isRTL(row.pit());
        bool need_new_row = false;
 
-       row.clear();
        row.left_margin = leftMargin(row.pit(), pos);
        row.right_margin = right_margin;
        if (is_rtl)