]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
fix dialogs in LyX/Mac
[lyx.git] / src / lyxfunc.C
index 5ed01e177f8468f08c44e66695f385ff943c4749..a2dadf5f933fb7ab3d7cc7e420bd87291b8fe6ec 100644 (file)
@@ -1334,7 +1334,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                                       << (unknown_tokens == 1 ? "" : "s")
                                       << endl;
                        }
-                       
+
                        if (defaults.writeFile(defaults.fileName()))
                                setMessage(_("Document defaults saved in ")
                                           + MakeDisplayPath(fname));
@@ -1422,9 +1422,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
 
                default: {
                        update = false;
-                       DispatchResult res = view()->cursor().dispatch(cmd);
-                       if (res.dispatched())
-                               update |= res.update();
+                       view()->cursor().dispatch(cmd);
+                       if (view()->cursor().result().dispatched())
+                               update |= view()->cursor().result().update();
                        else
                                update |= view()->dispatch(cmd);
 
@@ -1433,7 +1433,16 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                }
 
                if (view()->available()) {
-                       if (view()->fitCursor() || update)
+                       // Redraw screen unless explicitly told otherwise.
+                       // This also initializes the position cache for all insets
+                       // in (at least partially) visible top-level paragraphs.
+                       if (update)
+                               view()->update();
+
+                       // fitCursor() needs valid inset position. The previous call to
+                       // update() makes sure we have such even for freshly created
+                       // insets.
+                       if (view()->fitCursor())
                                view()->update();
                        // if we executed a mutating lfun, mark the buffer as dirty
                        if (getStatus(cmd).enabled()