]> git.lyx.org Git - features.git/commitdiff
* avoid redraw if possible (OK by Abdel and Dov)
authorStefan Schimanski <sts@lyx.org>
Wed, 30 May 2007 19:38:22 +0000 (19:38 +0000)
committerStefan Schimanski <sts@lyx.org>
Wed, 30 May 2007 19:38:22 +0000 (19:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18580 a592a061-630c-0410-9148-cb99ea01b6c8

src/Cursor.cpp
src/Cursor.h
src/Text3.cpp

index b3bdadeb6cf3cbe65ba4500a0e550481dfa16253..d34f348d7307de57cb7324e85ef93025fc201109 100644 (file)
@@ -1168,7 +1168,7 @@ bool Cursor::upDownInMath(bool up)
 }
 
 
-bool Cursor::upDownInText(bool up) 
+bool Cursor::upDownInText(bool up, bool & updateNeeded
 {
        BOOST_ASSERT(text());
 
@@ -1248,12 +1248,11 @@ bool Cursor::upDownInText(bool up)
                Cursor dummy = *this;
                if (dummy == old)
                        ++dummy.pos();
-               
-               bool const changed = bv().checkDepm(dummy, old);
-               
-               // Make sure that cur gets back whatever happened to dummy(Lgb)
-               if (changed)
+               if (bv().checkDepm(dummy, old)) {
+                       updateNeeded = true;
+                       // Make sure that cur gets back whatever happened to dummy(Lgb)
                        operator=(dummy);
+               }
        } else {
                // if there is a selection, we stay out of any inset, and just jump to the right position:
                Cursor old = *this;
@@ -1274,7 +1273,7 @@ bool Cursor::upDownInText(bool up)
                        }
                }
                
-               bv().checkDepm(*this, old);
+               updateNeeded |= bv().checkDepm(*this, old);
        }
        
        updateTextTargetOffset();
index c33478d523356f1ce029e343097223f192a9ec31..998b66767987cd0c95b8d00f1635171727aba238 100644 (file)
@@ -256,12 +256,17 @@ public:
        /// return false for empty math insets
        bool backspace();
        /// move the cursor up by sending an internal LFUN_UP
+       /// return true if fullscreen update is needed
        bool up();
-       /// move the cursor up by sending an internal LFUN_DOWN
+       /// move the cursor up by sending an internal LFUN_DOWN,
+       /// return true if fullscreen update is needed
        bool down();
-       /// move up/down in a text inset, called for LFUN_UP/DOWN
-       bool upDownInText(bool up);
+       /// move up/down in a text inset, called for LFUN_UP/DOWN,
+       /// return true if successful, updateNeeded set to true if fullscreen
+       /// update is needed, otherwise it's not touched
+       bool upDownInText(bool up, bool & updateNeeded);
        /// move up/down in math or any non text inset, call for LFUN_UP/DOWN
+       /// return true if successful
        bool upDownInMath(bool up);
        ///
        void plainErase();
index 968b893a01ed308918c98cd1ead073d88bbb9bee..396202436d1aa4d2a48474d3969f5164cd5008aa 100644 (file)
@@ -467,30 +467,28 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_UP:
-       case LFUN_UP_SELECT:
+       case LFUN_UP_SELECT: {
                //lyxerr << "handle LFUN_UP[SEL]:\n" << cur << endl;
                needsUpdate |= cur.selHandle(cmd.action == LFUN_UP_SELECT);
-               needsUpdate |= cur.upDownInText(true);
-
-               if (!needsUpdate && oldTopSlice == cur.top()
-                         && cur.boundary() == oldBoundary)
+               bool const successful = cur.upDownInText(true, needsUpdate);
+               if (!successful)
                        cur.undispatched();
                if (cur.selection())
                        saveSelection(cur);
                break;
+       }
 
        case LFUN_DOWN:
-       case LFUN_DOWN_SELECT:
+       case LFUN_DOWN_SELECT: {
                //lyxerr << "handle LFUN_DOWN[SEL]:\n" << cur << endl;
                needsUpdate |= cur.selHandle(cmd.action == LFUN_DOWN_SELECT);
-               needsUpdate |= cur.upDownInText(false);
-
-               if (!needsUpdate && oldTopSlice == cur.top() &&
-                   cur.boundary() == oldBoundary)
+               bool const successful = cur.upDownInText(false, needsUpdate);
+               if (!successful)
                        cur.undispatched();
                if (cur.selection())
                        saveSelection(cur);
                break;
+       }
 
        case LFUN_PARAGRAPH_UP:
        case LFUN_PARAGRAPH_UP_SELECT: