Remove non-const version of ParagraphMetrics::getRow

Constify a bit TextMetrics::isRTLBoundary().
This commit is contained in:
Jean-Marc Lasgouttes 2020-10-01 14:58:18 +02:00
parent a2b754b10b
commit e16b9e8d22
3 changed files with 4 additions and 25 deletions

View File

@ -88,25 +88,6 @@ void ParagraphMetrics::setPosition(int position)
}
Row & ParagraphMetrics::getRow(pos_type pos, bool boundary)
{
LBUFERR(!rows().empty());
// If boundary is set we should return the row on which
// the character before is inside.
if (pos > 0 && boundary)
--pos;
RowList::iterator rit = rows_.end();
RowList::iterator const begin = rows_.begin();
for (--rit; rit != begin && rit->pos() > pos; --rit)
;
return *rit;
}
Row const & ParagraphMetrics::getRow(pos_type pos, bool boundary) const
{
LBUFERR(!rows().empty());

View File

@ -54,8 +54,6 @@ public:
void reset(Paragraph const & par);
///
Row & getRow(pos_type pos, bool boundary);
///
Row const & getRow(pos_type pos, bool boundary) const;
///

View File

@ -388,13 +388,13 @@ bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos,
|| !contains(pit))
return false;
ParagraphMetrics & pm = par_metrics_[pit];
ParagraphMetrics const & pm = par_metrics_[pit];
// no RTL boundary in empty paragraph
if (pm.rows().empty())
return false;
pos_type endpos = pm.getRow(pos - 1, false).endpos();
pos_type startpos = pm.getRow(pos, false).pos();
pos_type const endpos = pm.getRow(pos - 1, false).endpos();
pos_type const startpos = pm.getRow(pos, false).pos();
// no RTL boundary at line start:
// abc\n -> toggle to RTL -> abc\n (and not: abc\n|
// | | )
@ -412,7 +412,7 @@ bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos,
|| par.isSeparator(pos - 1)))
return false;
bool left = font.isVisibleRightToLeft();
bool const left = font.isVisibleRightToLeft();
bool right;
if (pos == par.size())
right = par.isRTL(bv_->buffer().params());