mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
Only compute string length every 30 characters
This makes paragraph rebreaking muh much faster, at least on my ancient iMac Core 2 Duo.
This commit is contained in:
parent
b68f391232
commit
25727ee5a8
15
src/Row.cpp
15
src/Row.cpp
@ -333,11 +333,16 @@ void Row::add(pos_type const pos, char_type const c,
|
||||
Element e(STRING, pos, f, ch);
|
||||
elements_.push_back(e);
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user