mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Avoid bleeding of inset background outside of inset
As a consequence of fix e64ea357
to ticket #10797, we draw a bit too
much of the inset background outside of the inset (visible for insets
with colored background). #10797 is a ticket that triggers when the
cursor has a width larger than 1.
This patch limits the problems in two respects
* nothing is done on the left, since the cursor width only expands on
the right.
* on the right, the extra width is limited to cursor width.
Fixes bug #11786.
This commit is contained in:
parent
52cd43dfdc
commit
eb92f74d1f
@ -1927,15 +1927,15 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
|
|||||||
LYXERR(Debug::PAINTING, "Clear rect@("
|
LYXERR(Debug::PAINTING, "Clear rect@("
|
||||||
<< max(row_x, 0) << ", " << y - row.ascent() << ")="
|
<< max(row_x, 0) << ", " << y - row.ascent() << ")="
|
||||||
<< width() << " x " << row.height());
|
<< width() << " x " << row.height());
|
||||||
// FIXME: this is a hack. We know that at least this
|
// FIXME: this is a hack. We clear an amount equal to
|
||||||
// amount of pixels can be cleared on right and left.
|
// cursor width. This will not work if the caret has a
|
||||||
// Doing so gets rid of caret ghosts when the cursor is at
|
// ridiculous width like 6. (see ticket #10797)
|
||||||
// the begining/end of row. However, it will not work if
|
// This is the same formula as in GuiWorkArea.
|
||||||
// the caret has a ridiculous width like 6. (see ticket
|
int const caret_width = lyxrc.cursor_width
|
||||||
// #10797)
|
? lyxrc.cursor_width
|
||||||
pi.pain.fillRectangle(max(row_x, 0) - Inset::textOffset(pi.base.bv),
|
: 1 + int((lyxrc.currentZoom + 50) / 200.0);
|
||||||
y - row.ascent(),
|
pi.pain.fillRectangle(max(row_x, 0), y - row.ascent(),
|
||||||
width() + 2 * Inset::textOffset(pi.base.bv),
|
width() + caret_width,
|
||||||
row.height(), pi.background_color);
|
row.height(), pi.background_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user