mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Remove workaround that is not necessary anymore.
This code was necessary to handle cases where the insets positions were not yet in cache. This cannot happen anymore thanks to the nodraw stage.
This commit is contained in:
parent
8edadee145
commit
fb655725b7
@ -67,11 +67,6 @@ drawing from metrics.
|
||||
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
|
||||
|
@ -2995,7 +2995,7 @@ bool BufferView::needRepaint(Text const * text, Row const & row) const
|
||||
}
|
||||
|
||||
|
||||
void BufferView::checkCursorScrollOffset(PainterInfo & pi)
|
||||
void BufferView::checkCursorScrollOffset()
|
||||
{
|
||||
CursorSlice rowSlice = d->cursor_.bottom();
|
||||
TextMetrics const & tm = textMetrics(rowSlice.text());
|
||||
@ -3012,34 +3012,6 @@ void BufferView::checkCursorScrollOffset(PainterInfo & pi)
|
||||
// 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_;
|
||||
|
||||
@ -3106,7 +3078,7 @@ void BufferView::draw(frontend::Painter & pain, bool paint_caret)
|
||||
|
||||
// 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_) {
|
||||
|
||||
|
@ -42,7 +42,6 @@ class FuncStatus;
|
||||
class Intl;
|
||||
class Inset;
|
||||
class Length;
|
||||
class PainterInfo;
|
||||
class ParIterator;
|
||||
class ParagraphMetrics;
|
||||
class Point;
|
||||
@ -374,7 +373,7 @@ private:
|
||||
|
||||
// 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.
|
||||
|
@ -454,19 +454,6 @@ int Cursor::currentMode()
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -216,8 +216,6 @@ public:
|
||||
/// 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
|
||||
|
Loading…
Reference in New Issue
Block a user