On Tue, Sep 27, 2005 at 06:33:25PM +0300, Martin Vermeer wrote: > On Tue, Sep 27, 2005 at 04:58:22PM +0200, Jean-Marc Lasgouttes wrote: > > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
... > > I do not know how to fix it, so I'll ask questions instead :) > > > > case LFUN_UP_PARAGRAPH: > > if (!cur.mark()) > > cur.clearSelection(); > > needsUpdate = cursorUpParagraph(cur); > > + cur.bv().update(Update::Force | Update::FitCursor); > > finishChange(cur, false); > > break; > > > > > > So here we have code that tries carefully to update only if > > cursorUpParagraph says so, and then you issue what looks to me as a > > full update. Why do you need to do that? Could you explain what you > > are doing in this special case? > > OK ... I get it. > > Changed the code as follows: > > case LFUN_UP_PARAGRAPH: > if (!cur.mark()) > cur.clearSelection(); > needsUpdate = cursorUpParagraph(cur); > lyxerr << "needsUpdate=" << needsUpdate << endl; > //cur.bv().update(Update::Force | Update::FitCursor); > finishChange(cur, false); > break; > > As I understand it, the idea is that if a paragraph up motion takes the > cursor off-screen, needsUpdate should become true. Right? > > It doesn't... and the screen doesn't scroll up with the update stmt > commented out. > > Is this a bug inside cursorUpParagraph? Alternatively, should we really try to interpret every boolean that gets returned somewhere as a sign that the screen needs updating? See attached. Same functionality. - Martin
Index: text3.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v retrieving revision 1.308 diff -u -p -r1.308 text3.C --- text3.C 27 Sep 2005 08:42:28 -0000 1.308 +++ text3.C 27 Sep 2005 17:14:03 -0000 @@ -345,9 +345,10 @@ void LyXText::dispatch(LCursor & cur, Fu if (!cur.mark()) cur.clearSelection(); if (isRTL(cur.paragraph())) - needsUpdate = cursorLeftOneWord(cur); + cursorLeftOneWord(cur); else - needsUpdate = cursorRightOneWord(cur); + cursorRightOneWord(cur); + needsUpdate = true; finishChange(cur, false); break; @@ -355,9 +356,10 @@ void LyXText::dispatch(LCursor & cur, Fu if (!cur.mark()) cur.clearSelection(); if (isRTL(cur.paragraph())) - needsUpdate = cursorRightOneWord(cur); + cursorRightOneWord(cur); else - needsUpdate = cursorLeftOneWord(cur); + cursorLeftOneWord(cur); + needsUpdate = true; finishChange(cur, false); break; @@ -419,7 +421,8 @@ void LyXText::dispatch(LCursor & cur, Fu && cur.boundary() == oldBoundary) { cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_RIGHT); - } + } else + needsUpdate = true; break; case LFUN_LEFT: @@ -435,7 +438,8 @@ void LyXText::dispatch(LCursor & cur, Fu && cur.boundary() == oldBoundary) { cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_LEFT); - } + } else + needsUpdate = true; break; case LFUN_UP: @@ -449,7 +453,8 @@ void LyXText::dispatch(LCursor & cur, Fu && cur.boundary() == oldBoundary) { cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_UP); - } + } else + needsUpdate = true; break; case LFUN_DOWN: @@ -463,13 +468,15 @@ void LyXText::dispatch(LCursor & cur, Fu { cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_DOWN); - } + } else + needsUpdate = true; break; case LFUN_UP_PARAGRAPH: if (!cur.mark()) cur.clearSelection(); - needsUpdate = cursorUpParagraph(cur); + cursorUpParagraph(cur); + needsUpdate = true; finishChange(cur, false); break; @@ -483,7 +490,8 @@ void LyXText::dispatch(LCursor & cur, Fu case LFUN_DOWN_PARAGRAPH: if (!cur.mark()) cur.clearSelection(); - needsUpdate = cursorDownParagraph(cur); + cursorDownParagraph(cur); + needsUpdate = true; finishChange(cur, false); break; @@ -561,7 +569,8 @@ void LyXText::dispatch(LCursor & cur, Fu cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_UP); } else { - needsUpdate = cursorPrevious(cur); + cursorPrevious(cur); + needsUpdate = true; } break; @@ -575,7 +584,8 @@ void LyXText::dispatch(LCursor & cur, Fu cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_DOWN); } else { - needsUpdate = cursorNext(cur); + cursorNext(cur); + needsUpdate = true; } break; @@ -1117,6 +1127,9 @@ void LyXText::dispatch(LCursor & cur, Fu current_font.setLanguage(lang); real_current_font.setLanguage(lang); + // Remember the old paragraph metric + Dimension olddim = cur.paragraph().dim(); + string::const_iterator cit = cmd.argument.begin(); string::const_iterator end = cmd.argument.end(); for (; cit != end; ++cit) @@ -1125,12 +1138,13 @@ void LyXText::dispatch(LCursor & cur, Fu cur.resetAnchor(); moveCursor(cur, false); - - needsUpdate = redoParagraph(cur.pit()); + // Inserting characters changes par height + needsUpdate = cur.paragraph().dim().asc != olddim.asc || + cur.paragraph().dim().des != olddim.des; if (!needsUpdate) { - // update only this paragraph + // if not, update _only_ this paragraph cur.bv().update(Update::SinglePar | Update::Force); - } + } bv->updateScrollbar(); break;
pgp23RDEmtlAm.pgp
Description: PGP signature