mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Introducing FontList::setRange()
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21126 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3d33cd8bd3
commit
c86e632afa
@ -122,6 +122,14 @@ void FontList::decreasePosAfterPos(pos_type pos)
|
||||
}
|
||||
|
||||
|
||||
void FontList::setRange(pos_type startpos, pos_type endpos, Font const & font)
|
||||
{
|
||||
// FIXME: Optimize!!!
|
||||
for (pos_type pos = startpos; pos != endpos; ++pos)
|
||||
set(pos, font);
|
||||
}
|
||||
|
||||
|
||||
void FontList::set(pos_type pos, Font const & font)
|
||||
{
|
||||
// No need to simplify this because it will disappear
|
||||
|
@ -94,6 +94,11 @@ public:
|
||||
///
|
||||
void set(pos_type pos, Font const & font);
|
||||
///
|
||||
void setRange(
|
||||
pos_type startpos,
|
||||
pos_type endpos,
|
||||
Font const & font);
|
||||
///
|
||||
void increasePosAfterPos(pos_type pos);
|
||||
///
|
||||
void decreasePosAfterPos(pos_type pos);
|
||||
|
@ -1153,15 +1153,16 @@ void Paragraph::appendString(docstring const & s, Font const & font,
|
||||
Change const & change)
|
||||
{
|
||||
size_t end = s.size();
|
||||
pos_type startpos = text_.size();
|
||||
// FIXME: Optimize this!
|
||||
text_.reserve(text_.size() + end);
|
||||
text_.reserve(startpos + end);
|
||||
for (pos_type i = 0; i != end; ++i) {
|
||||
// track change
|
||||
d->changes_.insert(change, i);
|
||||
// when appending characters, no need to update tables
|
||||
text_.push_back(s[i]);
|
||||
setFont(i, font);
|
||||
}
|
||||
d->fontlist_.setRange(startpos, text_.size(), font);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user