mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 05:12:40 +00:00
Do not paint an invisible cursor.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27631 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
912979d2db
commit
550f1d9ce8
@ -2222,10 +2222,11 @@ Point BufferView::coordOffset(DocIterator const & dit, bool boundary) const
|
|||||||
|
|
||||||
Point BufferView::getPos(DocIterator const & dit, bool boundary) const
|
Point BufferView::getPos(DocIterator const & dit, bool boundary) const
|
||||||
{
|
{
|
||||||
|
if (!paragraphVisible(dit))
|
||||||
|
return Point(-1, -1);
|
||||||
|
|
||||||
CursorSlice const & bot = dit.bottom();
|
CursorSlice const & bot = dit.bottom();
|
||||||
TextMetrics const & tm = textMetrics(bot.text());
|
TextMetrics const & tm = textMetrics(bot.text());
|
||||||
if (!tm.contains(bot.pit()))
|
|
||||||
return Point(-1, -1);
|
|
||||||
|
|
||||||
Point p = coordOffset(dit, boundary); // offset from outer paragraph
|
Point p = coordOffset(dit, boundary); // offset from outer paragraph
|
||||||
p.y_ += tm.parMetrics(bot.pit()).position();
|
p.y_ += tm.parMetrics(bot.pit()).position();
|
||||||
@ -2233,6 +2234,15 @@ Point BufferView::getPos(DocIterator const & dit, bool boundary) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool BufferView::paragraphVisible(DocIterator const & dit) const
|
||||||
|
{
|
||||||
|
CursorSlice const & bot = dit.bottom();
|
||||||
|
TextMetrics const & tm = textMetrics(bot.text());
|
||||||
|
|
||||||
|
return tm.contains(bot.pit());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::draw(frontend::Painter & pain)
|
void BufferView::draw(frontend::Painter & pain)
|
||||||
{
|
{
|
||||||
if (height_ == 0 || width_ == 0)
|
if (height_ == 0 || width_ == 0)
|
||||||
|
@ -251,6 +251,8 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
Point getPos(DocIterator const & dit, bool boundary) const;
|
Point getPos(DocIterator const & dit, bool boundary) const;
|
||||||
|
/// is the paragraph of the cursor visible ?
|
||||||
|
bool paragraphVisible(DocIterator const & dit) const;
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -567,7 +567,8 @@ void GuiWorkArea::showCursor()
|
|||||||
|
|
||||||
// if it doesn't touch the screen, don't try to show it
|
// if it doesn't touch the screen, don't try to show it
|
||||||
bool cursorInView = true;
|
bool cursorInView = true;
|
||||||
if (y + h < 0 || y >= viewport()->height())
|
if (y + h < 0 || y >= viewport()->height()
|
||||||
|
|| !cur.bv().paragraphVisible(cur))
|
||||||
cursorInView = false;
|
cursorInView = false;
|
||||||
|
|
||||||
// show cursor on screen
|
// show cursor on screen
|
||||||
|
Loading…
Reference in New Issue
Block a user