]> git.lyx.org Git - features.git/commitdiff
Fix gotoLabel with inactive labels
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 31 Dec 2018 17:28:44 +0000 (18:28 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 31 Dec 2018 17:28:44 +0000 (18:28 +0100)
This now frist looks for the active label. Only if none is found, it
jumps to the (first) inactive label.

src/BufferView.cpp

index e2648a151ca6179848bbfabee257803977c6d381..6a32faa7b5b74e690db4c995eae0d1a84bdac12b 100644 (file)
@@ -2515,15 +2515,26 @@ bool BufferView::setCursorFromInset(Inset const * inset)
 
 void BufferView::gotoLabel(docstring const & label)
 {
+       FuncRequest action;
+       bool have_inactive = false;
        for (Buffer const * buf : buffer().allRelatives()) {
                // find label
                for (TocItem const & item : *buf->tocBackend().toc("label")) {
-                       if (label == item.str()) {
+                       if (label == item.str() && item.isOutput()) {
                                lyx::dispatch(item.action());
                                return;
                        }
+                       // If we find an inactive label, save it for the case
+                       // that no active one is there
+                       if (label == item.str() && !have_inactive) {
+                               have_inactive = true;
+                               action = item.action();
+                       }
                }
        }
+       // We only found an inactive label. Go there.
+       if (have_inactive)
+               lyx::dispatch(action);
 }