Fix this bug:

1. scroll a bit so that the cursor is not visible anymore
2. hit the keyboard arrow keys to move the cursor or type something

The problem was that TextMetrics::parMetric() automatically creates a new parmetrics on const access. This was needed in the old architecture but I don't think anymore.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23126 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-22 11:07:41 +00:00
parent 38a1df7cd4
commit 6564e9bb4e

View File

@ -406,10 +406,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// Signals that a full-screen update is required
bool needsUpdate = !(lyxaction.funcHasFlag(cmd.action,
LyXAction::NoUpdate) || singleParUpdate);
// Remember the old paragraph metric (_outer_ paragraph!)
ParagraphMetrics const & pm = cur.bv().parMetrics(
cur.bottom().text(), cur.bottom().pit());
Dimension olddim = pm.dim();
switch (cmd.action) {
@ -1820,16 +1816,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// FIXME: the following code should go in favor of fine grained
// update flag treatment.
if (singleParUpdate) {
// Inserting characters does not change par height
ParagraphMetrics const & pms
= cur.bv().parMetrics(cur.bottom().text(), cur.bottom().pit());
if (pms.dim().height() == olddim.height()) {
// if so, update _only_ this paragraph
cur.updateFlags(Update::SinglePar |
Update::FitCursor);
return;
}
needsUpdate = true;
// Inserting characters does not change par height in general. So, try
// to update _only_ this paragraph. BufferView will detect if a full
// metrics update is needed anyway.
cur.updateFlags(Update::SinglePar | Update::FitCursor);
return;
}
if (!needsUpdate