mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Change the way the element's width is updated.
Remove the code that computed the width every 30 characters (yay!). Make sure that finalizeLast() is called after inserting a row element in a row in breakParagraph.
This commit is contained in:
parent
49115315ea
commit
890fcc0872
11
src/Row.cpp
11
src/Row.cpp
@ -370,8 +370,7 @@ void Row::finalizeLast()
|
||||
if (elt.change.changed())
|
||||
changebar_ = true;
|
||||
|
||||
if (elt.type == STRING) {
|
||||
dim_.wid -= elt.dim.wid;
|
||||
if (elt.type == STRING && elt.dim.wid == 0) {
|
||||
elt.dim.wid = theFontMetrics(elt.font).width(elt.str);
|
||||
dim_.wid += elt.dim.wid;
|
||||
}
|
||||
@ -401,16 +400,8 @@ void Row::add(pos_type const pos, char_type const c,
|
||||
e.row_flags = can_break ? CanBreakInside : Inline;
|
||||
elements_.push_back(e);
|
||||
}
|
||||
if (back().str.length() % 30 == 0) {
|
||||
dim_.wid -= back().dim.wid;
|
||||
back().str += c;
|
||||
back().endpos = pos + 1;
|
||||
back().dim.wid = theFontMetrics(back().font).width(back().str);
|
||||
dim_.wid += back().dim.wid;
|
||||
} else {
|
||||
back().str += c;
|
||||
back().endpos = pos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1092,6 +1092,7 @@ RowList TextMetrics::breakParagraph(Row const & bigrow) const
|
||||
!elt.font.language()->wordWrap());
|
||||
// a new element in the row
|
||||
rows.back().push_back(elt);
|
||||
rows.back().finalizeLast();
|
||||
pos = elt.endpos;
|
||||
|
||||
// Go to next element
|
||||
|
Loading…
Reference in New Issue
Block a user