Other changes are only clean-ups.
** When a paragraph ends with a newline, compute correctly the height of the extra row.
-** Cleanup after complete metrics
- Then the following can be done:
- + remove hack in InsetMathNest::drawSelection
- + remove Cursor::inCoordCache?
-
** Merging bv::updateMetrics and tm::metrics
While the full metrics computation tries hard to limit the number of
}
-void BufferView::checkCursorScrollOffset(PainterInfo & pi)
+void BufferView::checkCursorScrollOffset()
{
CursorSlice rowSlice = d->cursor_.bottom();
TextMetrics const & tm = textMetrics(rowSlice.text());
// Set the row on which the cursor lives.
setCurrentRowSlice(rowSlice);
- // If insets referred to by cursor are not all in the cache, the positions
- // need to be recomputed.
- if (!d->cursor_.inCoordCache()) {
- /** FIXME: the code below adds an extraneous computation of
- * inset positions, and can therefore be bad for performance
- * (think for example about a very large tabular inset.
- * Redawing the row where it is means redrawing the whole
- * screen).
- *
- * The bug that this fixes is the following: assume that there
- * is a very large math inset. Upon entering the inset, when
- * pressing `End', the row is not scrolled and the cursor is
- * not visible. The extra row computation makes sure that the
- * inset positions are correctly computed and set in the
- * cache. This would not happen if we did not have two-stage
- * drawing.
- *
- * A proper fix would be to always have proper inset positions
- * at this point.
- */
- // Force the recomputation of inset positions
- frontend::NullPainter np;
- PainterInfo(this, np);
- // No need to care about vertical position.
- RowPainter rp(pi, buffer().text(), row, -d->horiz_scroll_offset_, 0);
- rp.paintText();
- }
-
// Current x position of the cursor in pixels
int cur_x = getPos(d->cursor_).x_;
// Check whether the row where the cursor lives needs to be scrolled.
// Update the drawing strategy if needed.
- checkCursorScrollOffset(pi);
+ checkCursorScrollOffset();
switch (d->update_strategy_) {
class Intl;
class Inset;
class Length;
-class PainterInfo;
class ParIterator;
class ParagraphMetrics;
class Point;
// Check whether the row where the cursor lives needs to be scrolled.
// Update the drawing strategy if needed.
- void checkCursorScrollOffset(PainterInfo & pi);
+ void checkCursorScrollOffset();
/// The minimal size of the document that is visible. Used
/// when it is allowed to scroll below the document.
}
-bool Cursor::inCoordCache() const
-{
- // the root inset is not in cache, but we do not need it.
- if (depth() == 1)
- return true;
- CoordCache::Insets const & icache = bv_->coordCache().getInsets();
- for (size_t i = 1 ; i < depth() ; ++i)
- if (!icache.has(&(*this)[i].inset()))
- return false;
- return true;
-}
-
-
void Cursor::getPos(int & x, int & y) const
{
Point p = bv().getPos(*this);
/// are we entering a macro name?
bool & macromode() { return macromode_; }
- /// returns true when all insets in cursor stack are in cache
- bool inCoordCache() const;
/// returns x,y position
void getPos(int & x, int & y) const;
/// return logical positions between which the cursor is situated