]> git.lyx.org Git - features.git/commitdiff
Take care of cursor update flags correctly and redraw if needed.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 23 Nov 2007 11:45:20 +0000 (11:45 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 23 Nov 2007 11:45:20 +0000 (11:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21739 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiView.cpp

index a4382d921be1bda3a2a4d2277198e3e9d492b550..a6239caa1d192b7e0d2b9eacfbf38c4b02edfaea 100644 (file)
@@ -1020,8 +1020,10 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd)
 
 void GuiView::dispatch(FuncRequest const & cmd)
 {
-       // By default we won't need any new update.
-       Update::flags update_flags = Update::None;
+       BufferView * bv = view();       
+       // By default we won't need any update.
+       if (bv)
+               bv->cursor().updateFlags(Update::None);
 
        switch(cmd.action) {
                case LFUN_BUFFER_SWITCH:
@@ -1143,9 +1145,6 @@ void GuiView::dispatch(FuncRequest const & cmd)
                        if (inset) {
                                FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument());
                                inset->dispatch(view()->cursor(), fr);
-                               // ideally, the update flag should be set by the insets,
-                               // but this is not possible currently
-                               update_flags = Update::Force | Update::FitCursor;
                        } else {
                                FuncRequest fr(LFUN_INSET_INSERT, cmd.argument());
                                lyx::dispatch(fr);
@@ -1156,10 +1155,14 @@ void GuiView::dispatch(FuncRequest const & cmd)
                default:
                        theLyXFunc().setLyXView(this);
                        lyx::dispatch(cmd);
+                       return;
        }
 
-       if (view())
-               view()->cursor().updateFlags(update_flags);
+       if (!bv)
+               return;
+       bv->processUpdateFlags(bv->cursor().result().update());
+       // We won't need any new update.
+       bv->cursor().updateFlags(Update::None);
 }