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.
This commit is contained in:
Juergen Spitzmueller 2018-12-31 18:28:44 +01:00
parent 5afacb144d
commit 54366c38ef

View 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);
}