mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
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:
parent
9cae1ffdc9
commit
32edb65985
29
src/Row.cpp
29
src/Row.cpp
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user