Abdelrazak Younes wrote:
> Georg Baum wrote:
>> So it
>> looks to me that there is a conceptual problem regarding the coord cache.
>
> Indeed.
OK, but we are no going to change that for 1.5.0 I guess.
>>> If you can live without the corners, uncommenting the last line for each
>>> of the
>>> LFUN would solve the problem.
>>
>> That does indeed solve it, but is not an option.
>> Leaving the pink corners out makes it very hard to hit the right
>> position.
>
> As I said, there is way to solved that issue differently by painting the
> corners independently from the text.
I am not going to rip the draw machinery apart right now, because I don't
know enough about it and I also think that now is not the right moment to
do so. But since uncommenting the cur.updateFlags() calls did solve the
problem I had the idea to only suppress the deletion of the coord cache,
not the drawing of the insets itself in these cases. Whether we draw the
text again even if we would only need to draw the pink corners does not
matter, and if it is slower this is preferrable over an off-screen cursor.
This is what the attached patch does. I added a new flag ClearCoordCache and
set it in all places where any update flag was set. Then I made sure that
this flag is not set in the lfuns in MathNestInset that do not need it, and
I finally clear the coord cache only if this flag is set.
This works very well for me, and if I don't get any objections I will put
this in.
>> BTW, it looks like the cause for this bug in 1.4 and 1.5 is a bit
>> different: In 1.4 the cache did not get set (I also get frequent aborts
>> via lyxbreaker if I try to go up with the arrow keys). In 1.5 it seems
>> that it gets set (I don't get these aborts, pressing the arrow will
>> simply move the cursor above the screen, and it becomes visible again if
>> it goes out of the inset.
>
> Yes, that's because, in 1.5, when the info is not in the cache, we use
> the logical information. A FitCursor is probably missing here.
You mean in 1.4? That may be the case. In 1.5 I don't think so, since the
screen is correctly scrolled with this patch applied.
Georg
Index: src/cursor.C
===================================================================
--- src/cursor.C (Revision 16763)
+++ src/cursor.C (Arbeitskopie)
@@ -301,7 +301,7 @@ void LCursor::dispatch(FuncRequest const
// The common case is 'LFUN handled, need update', so make the
// LFUN handler's life easier by assuming this as default value.
// The handler can reset the update and val flags if necessary.
- disp_.update(Update::FitCursor | Update::Force);
+ disp_.update(Update::FitCursor | Update::Force | Update::ClearCoordCache);
disp_.dispatched(true);
inset().dispatch(*this, cmd);
if (disp_.dispatched())
Index: src/insets/insetcollapsable.C
===================================================================
--- src/insets/insetcollapsable.C (Revision 16763)
+++ src/insets/insetcollapsable.C (Arbeitskopie)
@@ -369,7 +369,7 @@ void InsetCollapsable::doDispatch(LCurso
// Left button is clicked, the user asks to
// toggle the inset visual state.
cur.dispatched();
- cur.updateFlags(Update::Force | Update::FitCursor);
+ cur.updateFlags(Update::Force | Update::FitCursor | Update::ClearCoordCache);
if (status() == Collapsed) {
setStatus(cur, Open);
edit(cur, true);
Index: src/insets/insettabular.C
===================================================================
--- src/insets/insettabular.C (Revision 16763)
+++ src/insets/insettabular.C (Arbeitskopie)
@@ -1270,7 +1270,7 @@ void InsetTabular::resetPos(LCursor & cu
scx_ = 0;
}
- cur.updateFlags(Update::Force | Update::FitCursor);
+ cur.updateFlags(Update::Force | Update::FitCursor | Update::ClearCoordCache);
}
Index: src/insets/insetbase.C
===================================================================
--- src/insets/insetbase.C (Revision 16763)
+++ src/insets/insetbase.C (Arbeitskopie)
@@ -127,7 +127,7 @@ InsetBase::Code InsetBase::translate(std
void InsetBase::dispatch(LCursor & cur, FuncRequest & cmd)
{
- cur.updateFlags(Update::Force | Update::FitCursor);
+ cur.updateFlags(Update::Force | Update::FitCursor | Update::ClearCoordCache);
cur.dispatched();
doDispatch(cur, cmd);
}
Index: src/mathed/InsetMathNest.C
===================================================================
--- src/mathed/InsetMathNest.C (Revision 16763)
+++ src/mathed/InsetMathNest.C (Arbeitskopie)
@@ -499,11 +499,10 @@ void InsetMathNest::doDispatch(LCursor &
break;
case LFUN_CHAR_FORWARD:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
case LFUN_CHAR_FORWARD_SELECT:
cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
cur.autocorrect() = false;
@@ -522,11 +521,10 @@ void InsetMathNest::doDispatch(LCursor &
break;
case LFUN_CHAR_BACKWARD:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
case LFUN_CHAR_BACKWARD_SELECT:
cur.selHandle(cmd.action == LFUN_CHAR_BACKWARD_SELECT);
cur.autocorrect() = false;
@@ -546,11 +544,10 @@ void InsetMathNest::doDispatch(LCursor &
break;
case LFUN_UP:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
case LFUN_UP_SELECT:
// FIXME Tried to use clearTargetX and macroModeClose, crashed on cur.up()
if (cur.inMacroMode()) {
@@ -568,11 +565,10 @@ void InsetMathNest::doDispatch(LCursor &
break;
case LFUN_DOWN:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
case LFUN_DOWN_SELECT:
if (cur.inMacroMode()) {
cur.macroModeClose();
@@ -601,22 +597,20 @@ void InsetMathNest::doDispatch(LCursor &
case LFUN_PARAGRAPH_UP:
case LFUN_PARAGRAPH_DOWN:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
case LFUN_PARAGRAPH_UP_SELECT:
case LFUN_PARAGRAPH_DOWN_SELECT:
break;
case LFUN_LINE_BEGIN:
case LFUN_WORD_BACKWARD:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
case LFUN_LINE_BEGIN_SELECT:
case LFUN_WORD_BACKWARD_SELECT:
cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT ||
@@ -638,11 +632,10 @@ void InsetMathNest::doDispatch(LCursor &
case LFUN_WORD_FORWARD:
case LFUN_LINE_END:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
case LFUN_WORD_FORWARD_SELECT:
case LFUN_LINE_END_SELECT:
cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT ||
@@ -676,20 +669,18 @@ void InsetMathNest::doDispatch(LCursor &
break;
case LFUN_CELL_FORWARD:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
cur.inset().idxNext(cur);
break;
case LFUN_CELL_BACKWARD:
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
cur.inset().idxPrev(cur);
break;
@@ -1182,9 +1173,10 @@ void InsetMathNest::lfunMousePress(LCurs
if (cmd.button() == mouse_button::button1) {
//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
bv.mouseSetCursor(cur);
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset.
- //cur.noUpdate();
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
} else if (cmd.button() == mouse_button::button2) {
MathArray ar;
if (cur.selection()) {
@@ -1368,30 +1360,27 @@ bool InsetMathNest::interpretChar(LCurso
// it is better than nothing...
if (!cur.pos() != 0 || cur.prevAtom()->getChar() != ' ') {
cur.insert(c);
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::SinglePar | Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
}
return true;
}
if (cur.pos() != 0 && cur.prevAtom()->asSpaceInset()) {
cur.prevAtom().nucleus()->asSpaceInset()->incSpace();
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::SinglePar | Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
return true;
}
if (cur.popRight()) {
- // FIXME: we have to enable full redraw here because of the
- // visual box corners that define the inset. If we know for
- // sure that we stay within the same cell we can optimize for
- // that using:
- //cur.updateFlags(Update::FitCursor);
+ // We do not need to clear the coord cache since the only
+ // thing that can change are the pink corners of the active
+ // cell.
+ cur.updateFlags(Update::FitCursor | Update::Force);
return true;
}
Index: src/text2.C
===================================================================
--- src/text2.C (Revision 16763)
+++ src/text2.C (Arbeitskopie)
@@ -916,7 +916,7 @@ bool LyXText::checkAndActivateInset(LCur
bool LyXText::cursorLeft(LCursor & cur)
{
// Tell BufferView to test for FitCursor in any case!
- cur.updateFlags(Update::FitCursor);
+ cur.updateFlags(Update::FitCursor | Update::ClearCoordCache);
if (!cur.boundary() && cur.pos() > 0 &&
cur.textRow().pos() == cur.pos() &&
@@ -949,7 +949,7 @@ bool LyXText::cursorLeft(LCursor & cur)
bool LyXText::cursorRight(LCursor & cur)
{
// Tell BufferView to test for FitCursor in any case!
- cur.updateFlags(Update::FitCursor);
+ cur.updateFlags(Update::FitCursor | Update::ClearCoordCache);
if (cur.pos() != cur.lastpos()) {
if (cur.boundary())
@@ -981,7 +981,7 @@ bool LyXText::cursorRight(LCursor & cur)
bool LyXText::cursorUp(LCursor & cur)
{
// Tell BufferView to test for FitCursor in any case!
- cur.updateFlags(Update::FitCursor);
+ cur.updateFlags(Update::FitCursor | Update::ClearCoordCache);
TextMetrics const & tm = cur.bv().textMetrics(this);
ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
@@ -1040,7 +1040,7 @@ bool LyXText::cursorUp(LCursor & cur)
bool LyXText::cursorDown(LCursor & cur)
{
// Tell BufferView to test for FitCursor in any case!
- cur.updateFlags(Update::FitCursor);
+ cur.updateFlags(Update::FitCursor | Update::ClearCoordCache);
TextMetrics const & tm = cur.bv().textMetrics(this);
ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
Index: src/lyxfunc.C
===================================================================
--- src/lyxfunc.C (Revision 16763)
+++ src/lyxfunc.C (Arbeitskopie)
@@ -786,7 +786,7 @@ void LyXFunc::dispatch(FuncRequest const
// redraw the screen at the end (first of the two drawing steps).
//This is done unless explicitely requested otherwise
- Update::flags updateFlags = Update::FitCursor;
+ Update::flags updateFlags = Update::FitCursor | Update::ClearCoordCache;
FuncStatus const flag = getStatus(cmd);
if (!flag.enabled()) {
@@ -1123,7 +1123,7 @@ void LyXFunc::dispatch(FuncRequest const
lyx_view_->buffer()->lyxvc().registrer();
reloadBuffer();
}
- updateFlags = Update::Force;
+ updateFlags = Update::Force | Update::ClearCoordCache;
break;
case LFUN_VC_CHECK_IN:
@@ -1467,7 +1467,7 @@ void LyXFunc::dispatch(FuncRequest const
theFontLoader().update();
/// FIXME: only the current view will be updated. the Gui
/// class is able to furnish the list of views.
- updateFlags = Update::Force;
+ updateFlags = Update::Force | Update::ClearCoordCache;
break;
case LFUN_SET_COLOR: {
@@ -1536,7 +1536,7 @@ void LyXFunc::dispatch(FuncRequest const
}
// ideally, the update flag should be set by the insets,
// but this is not possible currently
- updateFlags = Update::Force | Update::FitCursor;
+ updateFlags = Update::Force | Update::FitCursor | Update::ClearCoordCache;
break;
}
@@ -1561,7 +1561,7 @@ void LyXFunc::dispatch(FuncRequest const
it->dispatch(tmpcur, fr);
}
}
- updateFlags = Update::Force | Update::FitCursor;
+ updateFlags = Update::Force | Update::FitCursor | Update::ClearCoordCache;
break;
}
@@ -1673,7 +1673,7 @@ void LyXFunc::dispatch(FuncRequest const
buffer->errors("Class Switch");
updateLabels(*buffer);
- updateFlags = Update::Force | Update::FitCursor;
+ updateFlags = Update::Force | Update::FitCursor | Update::ClearCoordCache;
break;
}
@@ -1700,7 +1700,7 @@ void LyXFunc::dispatch(FuncRequest const
/// some screen font changes.
/// FIXME: only the current view will be updated. the Gui
/// class is able to furnish the list of views.
- updateFlags = Update::Force;
+ updateFlags = Update::Force | Update::ClearCoordCache;
break;
}
@@ -1739,7 +1739,7 @@ void LyXFunc::dispatch(FuncRequest const
updateFlags = view()->cursor().result().update();
if (!view()->cursor().result().dispatched())
if (view()->dispatch(cmd))
- updateFlags = Update::Force | Update::FitCursor;
+ updateFlags = Update::Force | Update::FitCursor | Update::ClearCoordCache;
break;
}
}
Index: src/frontends/qt4/GuiWorkArea.C
===================================================================
--- src/frontends/qt4/GuiWorkArea.C (Revision 16763)
+++ src/frontends/qt4/GuiWorkArea.C (Arbeitskopie)
@@ -537,7 +537,7 @@ void GuiWorkArea::showCursor(int x, int
{
if (schedule_redraw_) {
if (buffer_view_ && buffer_view_->buffer()) {
- buffer_view_->update(Update::Force);
+ buffer_view_->update(Update::Force | Update::ClearCoordCache);
updateScreen();
viewport()->update(QRect(0, 0, viewport()->width(), viewport()->height()));
}
Index: src/frontends/WorkArea.C
===================================================================
--- src/frontends/WorkArea.C (Revision 16763)
+++ src/frontends/WorkArea.C (Arbeitskopie)
@@ -142,7 +142,7 @@ void WorkArea::redraw()
// metrics are already up to date.
if (&lyx_view_ != theApp()->currentView())
// FIXME: it would be nice to optimize for the off-screen case.
- buffer_view_->updateMetrics(false);
+ buffer_view_->updateMetrics(Update::ClearCoordCache);
updateScrollbar();
Index: src/UpdateFlags.h
===================================================================
--- src/UpdateFlags.h (Revision 16763)
+++ src/UpdateFlags.h (Arbeitskopie)
@@ -20,7 +20,9 @@ namespace Update {
FitCursor = 1,
Force = 2,
SinglePar = 4,
- MultiParSel = 8
+ MultiParSel = 8,
+ /// Clear the coord cache before recalculating the metrics
+ ClearCoordCache = 16
};
inline flags operator|(flags const f, flags const g)
Index: src/text3.C
===================================================================
--- src/text3.C (Revision 16763)
+++ src/text3.C (Arbeitskopie)
@@ -216,7 +216,7 @@ void LyXText::cursorPrevious(LCursor & c
cur.dispatch(FuncRequest(cur.selection()? LFUN_UP_SELECT: LFUN_UP));
finishUndo();
- cur.updateFlags(Update::Force | Update::FitCursor);
+ cur.updateFlags(Update::Force | Update::FitCursor | Update::ClearCoordCache);
}
@@ -236,7 +236,7 @@ void LyXText::cursorNext(LCursor & cur)
FuncRequest(cur.selection()? LFUN_DOWN_SELECT: LFUN_DOWN));
finishUndo();
- cur.updateFlags(Update::Force | Update::FitCursor);
+ cur.updateFlags(Update::Force | Update::FitCursor | Update::ClearCoordCache);
}
@@ -1512,7 +1512,7 @@ void LyXText::dispatch(LCursor & cur, Fu
// if so, update _only_ this paragraph
cur.updateFlags(Update::SinglePar |
Update::FitCursor |
- Update::MultiParSel);
+ Update::MultiParSel | Update::ClearCoordCache);
return;
} else
needsUpdate = true;
@@ -1532,9 +1532,9 @@ void LyXText::dispatch(LCursor & cur, Fu
// do it for all. This is not very harmfull as FitCursor will provoke
// a full redraw only if needed but still, a proper review of all LFUN
// should be done and this needsUpdate boolean can then be removed.
- cur.updateFlags(Update::FitCursor);
+ cur.updateFlags(Update::FitCursor | Update::ClearCoordCache);
else
- cur.updateFlags(Update::Force | Update::FitCursor);
+ cur.updateFlags(Update::Force | Update::FitCursor | Update::ClearCoordCache);
}
Index: src/BufferView.C
===================================================================
--- src/BufferView.C (Revision 16763)
+++ src/BufferView.C (Arbeitskopie)
@@ -201,7 +201,7 @@ void BufferView::setBuffer(Buffer * b)
}
if (buffer_)
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
if (buffer_ && graphics::Previews::status() != LyXRC::PREVIEW_OFF)
graphics::Previews::get().generateBufferPreviews(*buffer_);
@@ -267,7 +267,7 @@ bool BufferView::loadLyXFile(FileName co
// if successfully move to pit (returned par_id is not zero), update metrics
if (moveToPosition(pit, 0, pos).get<1>()) {
if (fitCursor())
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
}
}
@@ -285,7 +285,7 @@ void BufferView::resize()
lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION << endl;
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
switchKeyMap();
}
@@ -330,6 +330,8 @@ bool BufferView::update(Update::flags fl
<< "[fitcursor = " << (flags & Update::FitCursor)
<< ", forceupdate = " << (flags & Update::Force)
<< ", singlepar = " << (flags & Update::SinglePar)
+ << ", multiparsel = " << (flags & Update::MultiParSel)
+ << ", clearcoordcache = " << (flags & Update::ClearCoordCache)
<< "] buffer: " << buffer_ << endl;
}
@@ -357,7 +359,7 @@ bool BufferView::update(Update::flags fl
if (flags == Update::FitCursor) {
bool const fit_cursor = fitCursor();
if (fit_cursor)
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
// tell the frontend to update the screen if needed.
return fit_cursor;
}
@@ -366,11 +368,13 @@ bool BufferView::update(Update::flags fl
if (flags & Update::MultiParSel)
full_metrics |= multiParSel();
- bool const single_par = !full_metrics;
- updateMetrics(single_par);
+ if (full_metrics)
+ updateMetrics(flags & Update::ClearCoordCache);
+ else
+ updateMetrics((flags & Update::ClearCoordCache) | Update::SinglePar);
if (flags & Update::FitCursor && fitCursor())
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
// tell the frontend to update the screen.
return true;
@@ -468,7 +472,7 @@ void BufferView::scrollDocView(int value
tm.redoParagraph(anchor_ref_);
int const h = tm.parMetrics(anchor_ref_).height();
offset_ref_ = int((bar * t.paragraphs().size() - anchor_ref_) * h);
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
}
@@ -1104,7 +1108,7 @@ bool BufferView::workAreaDispatch(FuncRe
//metrics_info_.y1 = 0;
//metrics_info_.y2 = height_;
//
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
}
// This event (moving without mouse click) is not passed further.
@@ -1257,7 +1261,7 @@ bool BufferView::checkDepm(LCursor & cur
if (!changed)
return false;
- updateMetrics(false);
+ updateMetrics(Update::ClearCoordCache);
buffer_->changed();
return true;
}
@@ -1347,7 +1351,7 @@ ViewMetricsInfo const & BufferView::view
// FIXME: We should split-up updateMetrics() for the singlepar case.
-void BufferView::updateMetrics(bool singlepar)
+void BufferView::updateMetrics(Update::flags flags)
{
LyXText & buftext = buffer_->text();
TextMetrics & tm = textMetrics(&buftext);
@@ -1357,7 +1361,8 @@ void BufferView::updateMetrics(bool sing
anchor_ref_ = int(buftext.paragraphs().size() - 1);
offset_ref_ = 0;
}
-
+
+ bool singlepar = flags & Update::SinglePar;
// If the paragraph metrics has changed, we can not
// use the singlepar optimisation.
if (singlepar
@@ -1376,9 +1381,9 @@ void BufferView::updateMetrics(bool sing
// Rebreak anchor paragraph.
if (!singlepar)
tm.redoParagraph(pit);
-
+
// Clear out the position cache in case of full screen redraw.
- if (!singlepar)
+ if ((flags & Update::ClearCoordCache && !singlepar))
coord_cache_.clear();
int y0 = tm.parMetrics(pit).ascent() - offset_ref_;
Index: src/BufferView.h
===================================================================
--- src/BufferView.h (Revision 16763)
+++ src/BufferView.h (Arbeitskopie)
@@ -207,8 +207,12 @@ public:
/// \sa ViewMetricsInfo
ViewMetricsInfo const & viewMetricsInfo();
/// update the internal \c ViewMetricsInfo.
- /// \param singlepar indicates wether
- void updateMetrics(bool singlepar = false);
+ /// \param flags tells whether we are updating a single paragraph
+ /// (if the Update::SinglePar bit is set in flags) and
+ /// whether the coord cache should be cleared (if the
+ /// Update::ClearCoordCache bit is set in flags).
+ /// All other bits of flags are not used.
+ void updateMetrics(Update::flags flags);
///
TextMetrics const & textMetrics(LyXText const * t) const;
Index: src/text.C
===================================================================
--- src/text.C (Revision 16763)
+++ src/text.C (Arbeitskopie)
@@ -655,7 +655,7 @@ void LyXText::breakParagraph(LCursor & c
updateLabels(cur.buffer(), current_it, last_it);
// A singlePar update is not enough in this case.
- cur.updateFlags(Update::Force);
+ cur.updateFlags(Update::Force | Update::ClearCoordCache);
// This check is necessary. Otherwise the new empty paragraph will
// be deleted automatically. And it is more friendly for the user!
@@ -751,7 +751,7 @@ void LyXText::insertChar(LCursor & cur,
par.insertChar(cur.pos(), c, current_font, cur.buffer().params().trackChanges);
-// cur.updateFlags(Update::Force);
+// cur.updateFlags(Update::Force | Update::ClearCoordCache);
setCursor(cur.top(), cur.pit(), cur.pos() + 1);
charInserted();
}
@@ -882,7 +882,7 @@ void LyXText::acceptChange(LCursor & cur
finishUndo();
cur.clearSelection();
setCursorIntern(cur, it.pit(), it.pos());
- cur.updateFlags(Update::Force);
+ cur.updateFlags(Update::Force | Update::ClearCoordCache);
}
@@ -923,7 +923,7 @@ void LyXText::rejectChange(LCursor & cur
finishUndo();
cur.clearSelection();
setCursorIntern(cur, it.pit(), it.pos());
- cur.updateFlags(Update::Force);
+ cur.updateFlags(Update::Force | Update::ClearCoordCache);
}
@@ -1157,7 +1157,7 @@ bool LyXText::backspace(LCursor & cur)
setCurrentFont(cur);
// A singlePar update is not enough in this case.
-// cur.updateFlags(Update::Force);
+// cur.updateFlags(Update::Force | Update::ClearCoordCache);
setCursor(cur.top(), cur.pit(), cur.pos());
return needsUpdate;