diff --git a/src/Text.cpp b/src/Text.cpp index 4013905d6d..230d64c3ed 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1160,19 +1160,6 @@ bool Text::dissolveInset(Cursor & cur) { } -bool Text::isLastRow(pit_type pit, Row const & row) const -{ - return row.endpos() >= pars_[pit].size() - && pit + 1 == pit_type(paragraphs().size()); -} - - -bool Text::isFirstRow(pit_type pit, Row const & row) const -{ - return row.pos() == 0 && pit == 0; -} - - void Text::getWord(CursorSlice & from, CursorSlice & to, word_location const loc) { diff --git a/src/Text.h b/src/Text.h index f0d75fa8ef..fe8714079a 100644 --- a/src/Text.h +++ b/src/Text.h @@ -256,13 +256,6 @@ public: /// return true if this is the main text bool isMainText(Buffer const &) const; - /// is this row the last in the text? - /// FIXME: move to TextMetrics. - bool isLastRow(pit_type pit, Row const & row) const; - /// is this row the first in the text? - /// FIXME: move to TextMetrics. - bool isFirstRow(pit_type pit, Row const & row) const; - /// double spacing(Buffer const & buffer, Paragraph const & par) const; /// make a suggestion for a label diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 9bde046c8e..cde93d0cfb 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1457,6 +1457,20 @@ void TextMetrics::deleteLineForward(Cursor & cur) } +bool TextMetrics::isLastRow(pit_type pit, Row const & row) const +{ + ParagraphList const & pars = text_->paragraphs(); + return row.endpos() >= pars[pit].size() + && pit + 1 == pit_type(pars.size()); +} + + +bool TextMetrics::isFirstRow(pit_type pit, Row const & row) const +{ + return row.pos() == 0 && pit == 0; +} + + int TextMetrics::leftMargin(int max_width, pit_type pit) const { BOOST_ASSERT(pit >= 0); diff --git a/src/TextMetrics.h b/src/TextMetrics.h index 784e91fc36..77f4166f53 100644 --- a/src/TextMetrics.h +++ b/src/TextMetrics.h @@ -181,6 +181,11 @@ public: /// void deleteLineForward(Cursor & cur); + /// is this row the last in the text? + bool isLastRow(pit_type pit, Row const & row) const; + /// is this row the first in the text? + bool isFirstRow(pit_type pit, Row const & row) const; + /// Returns an inset if inset was hit, or 0 if not. /// \warning This method is not recursive! It will return the /// outermost inset within this Text. diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 82fa18dbb3..f85af08eef 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -389,7 +389,7 @@ void RowPainter::paintChangeBar() if (start == end || !par_.isChanged(start, end)) return; - int const height = text_.isLastRow(pit_, row_) + int const height = text_metrics_.isLastRow(pit_, row_) ? row_.ascent() : row_.height(); @@ -421,7 +421,7 @@ void RowPainter::paintDepthBar() return; depth_type prev_depth = 0; - if (!text_.isFirstRow(pit_, row_)) { + if (!text_metrics_.isFirstRow(pit_, row_)) { pit_type pit2 = pit_; if (row_.pos() == 0) --pit2; @@ -429,7 +429,7 @@ void RowPainter::paintDepthBar() } depth_type next_depth = 0; - if (!text_.isLastRow(pit_, row_)) { + if (!text_metrics_.isLastRow(pit_, row_)) { pit_type pit2 = pit_; if (row_.endpos() >= pars_[pit2].size()) ++pit2;