]> git.lyx.org Git - features.git/commitdiff
Attempt to fix #7673 in a more "interesting" way than in branch (where
authorRichard Heck <rgheck@comcast.net>
Sat, 3 Dec 2011 22:42:09 +0000 (22:42 +0000)
committerRichard Heck <rgheck@comcast.net>
Sat, 3 Dec 2011 22:42:09 +0000 (22:42 +0000)
we will be cautious, of course). The problem was that we were issuing
the Buffer::changed() signal before we did updateBuffer(), and this
caused an inconsistency. The idea here is to defer issuing this signal
until we call processUpdateFlags(). We know we need a redraw if we've
deleted a whole paragraph.

This should work properly, so long as checkDepm is called from within
the dispatch mechanism. There may, however, be other paths, and I've
noted one explicitly with a FIXME in Text2.cpp. I've tested a few
different variations, however, and I haven't seen any problems. But if
we do run into problems, we can go ahead and do the update there that we
were previously doing in checkDepm itself.

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

src/BufferView.cpp
src/Cursor.cpp
src/Cursor.h
src/Text2.cpp
src/Text3.cpp

index 139b99796c2486b11a657423adae727a76e24758..f43cd7363cc803784ee56121edfc54d5cf11e5eb 100644 (file)
@@ -2410,7 +2410,7 @@ bool BufferView::checkDepm(Cursor & cur, Cursor & old)
        d->cursor_ = cur;
 
        cur.forceBufferUpdate();
-       buffer_.changed(true);
+       cur.screenUpdateFlags(Update::Force);
        return true;
 }
 
index b20e981b32c506cab09c2e7cc34e1989bc0a55b9..fb4988f787ec7d8889f6b685347a51cd612100e2 100644 (file)
@@ -1968,8 +1968,12 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
 
                        updateNeeded |= bv().checkDepm(dummy, *this);
                        updateTextTargetOffset();
-                       if (updateNeeded)
+                       if (updateNeeded) {
                                forceBufferUpdate();
+                               // DEPM may have requested a screen update
+                               this->screenUpdateFlags(
+                                       this->screenUpdate() | dummy.screenUpdate());
+                       }
                }
                return false;
        }
@@ -1994,7 +1998,8 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                        ++dummy.pos();
                if (bv().checkDepm(dummy, old)) {
                        updateNeeded = true;
-                       // Make sure that cur gets back whatever happened to dummy (Lgb) 
+                       // Make sure that cur gets back whatever happened to dummy (Lgb)
+                       // This will include any screen update requested by DEPM
                        operator=(dummy);
                }
        } else {
index a7111c2908d0dc57c699d768182370834d2407fd..0d7441967866c2635fd9d6eea34a83355127f35c 100644 (file)
@@ -247,6 +247,8 @@ public:
         * Not using noScreenUpdate() should never be wrong.
         */
        void noScreenUpdate() const;
+       ///
+       Update::flags screenUpdate() const { return disp_.screenUpdate(); }
        /// fix cursor in circumstances that should never happen.
        /// \retval true if a fix occured.
        bool fixIfBroken();
index 14b03cfec5db6870460faf4d0a02f1a95ee7dd5f..199790cf2ac1361d02800cd187296e3e5719682d 100644 (file)
@@ -535,6 +535,9 @@ bool Text::setCursor(Cursor & cur, pit_type par, pos_type pos,
        bool const update_needed = !tm.contains(par);
        Cursor old = cur;
        setCursorIntern(cur, par, pos, setfont, boundary);
+       // FIXME There is a chance that we'll miss a screen update here.
+       // If so, then do DEPM and then check if cur wants an update and
+       // go ahead and do it, if so.
        return cur.bv().checkDepm(cur, old) || update_needed;
 }
 
index 96fa1af10d8fc54467e8a04b8e679d62a7c6e145..4c1d07bf46720cc8141b32cc79ba8a6034e76647 100644 (file)
@@ -630,8 +630,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                // provide it with two different cursors.
                                Cursor dummy = cur;
                                dummy.pos() = dummy.pit() = 0;
-                               if (cur.bv().checkDepm(dummy, cur))
+                               if (cur.bv().checkDepm(dummy, cur)) {
                                        cur.forceBufferUpdate();
+                                       // DEPM may have requested a screen update
+                                       cur.screenUpdateFlags(
+                                               cur.screenUpdate() | dummy.screenUpdate());
+                               }
                        }
                }
                break;
@@ -657,8 +661,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                Cursor dummy = cur;
                                dummy.pos() = cur.lastpos();
                                dummy.pit() = cur.lastpit();
-                               if (cur.bv().checkDepm(dummy, cur))
+                               if (cur.bv().checkDepm(dummy, cur)) {
                                        cur.forceBufferUpdate();
+                                       // DEPM may have requested a screen update
+                                       cur.screenUpdateFlags(
+                                               cur.screenUpdate() | dummy.screenUpdate());
+                               }
                        }
                }
                break;
@@ -841,8 +849,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                // provide it with two different cursors.
                                Cursor dummy = cur;
                                dummy.pos() = dummy.pit() = 0;
-                               if (cur.bv().checkDepm(dummy, cur))
+                               if (cur.bv().checkDepm(dummy, cur)) {
                                        cur.forceBufferUpdate();
+                                       // DEPM may have requested a screen update
+                                       cur.screenUpdateFlags(
+                                               cur.screenUpdate() | dummy.screenUpdate());
+                               }
                        }
                }
                break;
@@ -891,8 +903,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                                Cursor dummy = cur;
                                dummy.pos() = cur.lastpos();
                                dummy.pit() = cur.lastpit();
-                               if (cur.bv().checkDepm(dummy, cur))
+                               if (cur.bv().checkDepm(dummy, cur)) {
                                        cur.forceBufferUpdate();
+                                       // DEPM may have requested a screen update
+                                       cur.screenUpdateFlags(
+                                               cur.screenUpdate() | dummy.screenUpdate());
+                               }
                        }
                }
                break;