[LyX/master] Remove non-const version of ParagraphMetrics::getRow
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Thu Oct 1 12:35:23 UTC 2020
commit e16b9e8d22898278c15960a32058a576703990d2
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Thu Oct 1 14:58:18 2020 +0200
Remove non-const version of ParagraphMetrics::getRow
Constify a bit TextMetrics::isRTLBoundary().
---
src/ParagraphMetrics.cpp | 19 -------------------
src/ParagraphMetrics.h | 2 --
src/TextMetrics.cpp | 8 ++++----
3 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/src/ParagraphMetrics.cpp b/src/ParagraphMetrics.cpp
index 0cbe3e9..72b212b 100644
--- a/src/ParagraphMetrics.cpp
+++ b/src/ParagraphMetrics.cpp
@@ -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());
diff --git a/src/ParagraphMetrics.h b/src/ParagraphMetrics.h
index 63ed0f3..9ddc1b0 100644
--- a/src/ParagraphMetrics.h
+++ b/src/ParagraphMetrics.h
@@ -55,8 +55,6 @@ public:
void reset(Paragraph const & par);
///
- Row & getRow(pos_type pos, bool boundary);
- ///
Row const & getRow(pos_type pos, bool boundary) const;
///
size_t pos2row(pos_type pos) const;
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 681985b..5cc4586 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -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());
More information about the lyx-cvs
mailing list