]> git.lyx.org Git - features.git/commitdiff
Fix screen updates with arrow key navigation.
authorAbdelrazak Younes <younes@lyx.org>
Mon, 27 Nov 2006 12:49:28 +0000 (12:49 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 27 Nov 2006 12:49:28 +0000 (12:49 +0000)
* text2.C
  - LyXText::cursorUp(): ensure that BufferView::FitCursor() is tested.
  - LyXText::cursorDown(): ditto
  - LyXText::cursorRight(): ditto
  - LyXText::cursorLeft(): ditto

* text3.C
  - LyXText::dispatch(): add FIXME and ensure that update flag is at least equal to FitCursor.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16072 a592a061-630c-0410-9148-cb99ea01b6c8

src/text2.C
src/text3.C

index 0513d5181c24454afdcd574ff0d8553f070b2c41..680fa350ee1d6cac1d376a85a795768ff508d93d 100644 (file)
@@ -1024,6 +1024,9 @@ bool LyXText::checkAndActivateInset(LCursor & cur, bool front)
 
 bool LyXText::cursorLeft(LCursor & cur)
 {
+       // Tell BufferView to test for FitCursor in any case!
+       cur.updateFlags(Update::FitCursor);
+
        if (!cur.boundary() && cur.pos() > 0 &&
            cur.textRow().pos() == cur.pos() &&
            !cur.paragraph().isLineSeparator(cur.pos()-1) &&
@@ -1052,6 +1055,9 @@ bool LyXText::cursorLeft(LCursor & cur)
 
 bool LyXText::cursorRight(LCursor & cur)
 {
+       // Tell BufferView to test for FitCursor in any case!
+       cur.updateFlags(Update::FitCursor);
+
        if (cur.pos() != cur.lastpos()) {
                if (cur.boundary())
                        return setCursor(cur, cur.pit(), cur.pos(),
@@ -1081,6 +1087,9 @@ bool LyXText::cursorRight(LCursor & cur)
 
 bool LyXText::cursorUp(LCursor & cur)
 {
+       // Tell BufferView to test for FitCursor in any case!
+       cur.updateFlags(Update::FitCursor);
+
        Paragraph const & par = cur.paragraph();
        int row;
        int const x = cur.targetX();
@@ -1130,6 +1139,9 @@ bool LyXText::cursorUp(LCursor & cur)
 
 bool LyXText::cursorDown(LCursor & cur)
 {
+       // Tell BufferView to test for FitCursor in any case!
+       cur.updateFlags(Update::FitCursor);
+
        Paragraph const & par = cur.paragraph();
        int row;
        int const x = cur.targetX();
index f74cc67f178bdd295ae4a55ba5a02bab65a7e40e..96ef5b1ec3d048bf3a19fc1fbe2f9d086bd6cd9d 100644 (file)
@@ -1518,7 +1518,16 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
            && oldTopSlice.idx() == cur.idx()
            && !sel // sel is a backup of cur.selection() at the biginning of the function.
            && !cur.selection())
-               cur.noUpdate();
+               // FIXME: it would be better if we could just do this
+               //
+               //if (cur.result().update() != Update::FitCursor)
+               //      cur.noUpdate();
+               // 
+               // But some LFUNs do not set Update::FitCursor when needed, so we
+               // 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);
        else
                cur.updateFlags(Update::Force | Update::FitCursor);
 }