mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Remove non-const version of ParagraphMetrics::getRow
Constify a bit TextMetrics::isRTLBoundary().
This commit is contained in:
parent
a2b754b10b
commit
e16b9e8d22
@ -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());
|
||||
|
@ -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;
|
||||
///
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user