mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 22:41:09 +00:00
simplify setInsetFont, removing a potential bug (an invalid DocIterator was built). Use CursorSlices when possible.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19690 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6f7f17098d
commit
c1b155fbe8
@ -314,25 +314,16 @@ void Text::setInsetFont(Buffer const & buffer, pit_type pit,
|
|||||||
pars_[pit].getInset(pos)->noFontChange());
|
pars_[pit].getInset(pos)->noFontChange());
|
||||||
|
|
||||||
Inset * const inset = pars_[pit].getInset(pos);
|
Inset * const inset = pars_[pit].getInset(pos);
|
||||||
DocIterator dit = doc_iterator_begin(*inset);
|
CursorSlice::idx_type endidx = inset->nargs();
|
||||||
// start of the last cell
|
for (CursorSlice cs(*inset); cs.idx() != endidx; ++cs.idx()) {
|
||||||
DocIterator end = dit;
|
Text * text = cs.text();
|
||||||
end.idx() = end.lastidx();
|
if (text) {
|
||||||
|
|
||||||
while (true) {
|
|
||||||
Text * text = dit.text();
|
|
||||||
Inset * cell = dit.realInset();
|
|
||||||
if (text && cell) {
|
|
||||||
DocIterator cellbegin = doc_iterator_begin(*cell);
|
|
||||||
// last position of the cell
|
// last position of the cell
|
||||||
DocIterator cellend = cellbegin;
|
CursorSlice cellend = cs;
|
||||||
cellend.pit() = cellend.lastpit();
|
cellend.pit() = cellend.lastpit();
|
||||||
cellend.pos() = cellend.lastpos();
|
cellend.pos() = cellend.lastpos();
|
||||||
text->setFont(buffer, cellbegin.top(), cellend.top(), font, toggleall);
|
text->setFont(buffer, cs, cellend, font, toggleall);
|
||||||
}
|
}
|
||||||
if (dit == end)
|
|
||||||
break;
|
|
||||||
dit.forwardIdx();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user