}
-bool BufferView::cursorInView(Point const & p, int h) const
+bool BufferView::caretInView() const
{
- Cursor const & cur = cursor();
+ if (!paragraphVisible(cursor()))
+ return false;
+ Point p;
+ int h;
+ caretPosAndHeight(p, h);
+
// does the cursor touch the screen ?
- if (p.y_ + h < 0 || p.y_ >= workHeight() || !paragraphVisible(cur))
+ if (p.y_ + h < 0 || p.y_ >= workHeight())
return false;
return true;
}
Point getPos(DocIterator const & dit) const;
/// is the paragraph of the cursor visible ?
bool paragraphVisible(DocIterator const & dit) const;
- /// is the cursor currently visible in the view
- bool cursorInView(Point const & p, int h) const;
+ /// is the caret currently visible in the view
+ bool caretInView() const;
/// get the position and height of the caret
void caretPosAndHeight(Point & p, int & h) const;
if (view().busy())
return;
- Point p;
- int h = 0;
- d->buffer_view_->caretPosAndHeight(p, h);
// Don't start blinking if the cursor isn't on screen.
- if (!d->buffer_view_->cursorInView(p, h))
+ if (!d->buffer_view_->caretInView())
return;
d->showCaret();
// Warn our container (GuiView).
p->busy(true);
- Point point;
- int h = 0;
- buffer_view_->caretPosAndHeight(point, h);
- bool const caret_in_view = buffer_view_->cursorInView(point, h);
+ bool const caret_in_view = buffer_view_->caretInView();
buffer_view_->resize(p->viewport()->width(), p->viewport()->height());
if (caret_in_view)
buffer_view_->scrollToCursor();
void GuiWorkArea::Private::updateCaretGeometry()
{
+ if (!buffer_view_->caretInView())
+ return;
+
Point point;
int h = 0;
buffer_view_->caretPosAndHeight(point, h);
- if (!buffer_view_->cursorInView(point, h))
- return;
// RTL or not RTL
bool l_shape = false;