From: Juergen Spitzmueller Date: Mon, 31 Dec 2018 17:28:44 +0000 (+0100) Subject: Fix gotoLabel with inactive labels X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=73acd4c3ff5187993d4a79410dad9c682aa77edd;p=features.git Fix gotoLabel with inactive labels This now frist looks for the active label. Only if none is found, it jumps to the (first) inactive label. --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index e2648a151c..6a32faa7b5 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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); }