mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Fix crash when adding newline at the end of a paragraph
This is a regression at b0673bd1
. The code referred to row.pit(),
which was not correctly initialized in this case. The bug does not
exist in master, since the code in redoParagraph has been cleaned-up
and row.pit() is always correct.
Two corrective measures are taken, each of which would fix the bug:
- do not use row.pit() in breakRow, but directly the pit parameter.
- initialize row.pit() correctly in the faulty case.
This commit is contained in:
parent
90f7cf2fd0
commit
7808a20e5c
@ -481,6 +481,7 @@ bool TextMetrics::redoParagraph(pit_type const pit)
|
||||
pm.rows().push_back(Row());
|
||||
Row & row = pm.rows()[row_index];
|
||||
row.pos(first);
|
||||
row.pit(pit);
|
||||
breakRow(row, right_margin, pit);
|
||||
setRowHeight(row, pit);
|
||||
row.setChanged(false);
|
||||
@ -932,8 +933,8 @@ void TextMetrics::breakRow(Row & row, int const right_margin, pit_type const pit
|
||||
|
||||
// if the row is too large, try to cut at last separator. In case
|
||||
// of success, reset indication that the row was broken abruptly.
|
||||
int const next_width = max_width_ - leftMargin(max_width_, row.pit(), row.endpos())
|
||||
- rightMargin(row.pit());
|
||||
int const next_width = max_width_ - leftMargin(max_width_, pit, row.endpos())
|
||||
- rightMargin(pit);
|
||||
|
||||
row.shortenIfNeeded(body_pos, width, next_width);
|
||||
row.right_boundary(!row.empty() && row.endpos() < end
|
||||
|
Loading…
Reference in New Issue
Block a user