]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
and this
[lyx.git] / src / lyxfunc.C
index f4fac34f66115f3050800e2d55a387f41d6c6c73..bbff9e1f5ae0b54fb67c2c8e0c893b4a8a7627b0 100644 (file)
@@ -503,6 +503,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_SAVE_AS_DEFAULT:
        case LFUN_BUFFERPARAMS_APPLY:
        case LFUN_LYXRC_APPLY:
+       case LFUN_NEXTBUFFER:
+       case LFUN_PREVIOUSBUFFER:
                // these are handled in our dispatch()
                break;
 
@@ -958,6 +960,14 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                        view()->setBuffer(bufferlist.getBuffer(argument));
                        break;
 
+               case LFUN_NEXTBUFFER:
+                       view()->setBuffer(bufferlist.next(view()->buffer()));
+                       break;
+
+               case LFUN_PREVIOUSBUFFER:
+                       view()->setBuffer(bufferlist.previous(view()->buffer()));
+                       break;
+
                case LFUN_FILE_NEW:
                        NewFile(view(), argument);
                        break;
@@ -1334,7 +1344,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));
@@ -1433,7 +1443,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()