Avoid showing vertical scroll mark when not necessary

Now the mark if only shown when editable text is outside of the row.

Fixes bug #9807.
This commit is contained in:
Jean-Marc Lasgouttes 2015-10-25 23:58:58 +01:00
parent 9cae1ffdc9
commit 32edb65985
3 changed files with 36 additions and 2 deletions

View File

@ -259,6 +259,35 @@ ostream & operator<<(ostream & os, Row const & row)
}
int Row::left_x() const
{
double x = left_margin;
const_iterator const end = elements_.end();
const_iterator cit = elements_.begin();
while (cit != end && cit->isVirtual()) {
x += cit->full_width();
++cit;
}
return int(x + 0.5);
}
int Row::right_x() const
{
double x = dim_.wid;
const_iterator const begin = elements_.begin();
const_iterator cit = elements_.end();
while (cit != begin) {
--cit;
if (cit->isVirtual())
x -= cit->full_width();
else
break;
}
return int(x + 0.5);
}
int Row::countSeparators() const
{
int n = 0;

View File

@ -170,6 +170,11 @@ public:
///
int descent() const { return dim_.des; }
/// The offset of the left-most cursor position on the row
int left_x() const;
/// The offset of the right-most cursor position on the row
int right_x() const;
// Return the number of separators in the row
int countSeparators() const;
// Set the extra spacing for every separator in STRING elements

View File

@ -1956,8 +1956,8 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
rp.paintLast();
if (i == 0 && is_rtl)
rp.paintFirst();
rp.paintTooLargeMarks(row_x < 0,
row_x + row.width() > bv_->workWidth());
rp.paintTooLargeMarks(row_x < row.left_x(),
row_x + row.right_x() > bv_->workWidth());
y += row.descent();
// Restore full_repaint status.