mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Fix bug with display of reference tooltips.
Previously, the tooltip was assigned during updateBuffer. But then we could not determine the value for forward references.
This commit is contained in:
parent
f2e6a9b4ae
commit
b494286a9c
@ -527,21 +527,15 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType, bool const /*del
|
|||||||
label += "||";
|
label += "||";
|
||||||
label += getParam("name");
|
label += getParam("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool const use_formatted_ref = buffer().params().use_formatted_ref;
|
// The tooltip will be over-written later, in addToToc, if need be.
|
||||||
unsigned int const maxLabelChars = 24;
|
tooltip_ = label;
|
||||||
toc_string_ = label;
|
toc_string_ = label;
|
||||||
// Show label in tooltip when formatted references are shown in the work
|
|
||||||
// area or it is too long
|
unsigned int const maxLabelChars = 24;
|
||||||
if (use_formatted_ref || label.size() > maxLabelChars) {
|
support::truncateWithEllipsis(label, maxLabelChars);
|
||||||
tooltip_ = label;
|
|
||||||
support::truncateWithEllipsis(label, maxLabelChars);
|
|
||||||
} else {
|
|
||||||
// put cross-reference value into tooltip
|
|
||||||
tooltip_ = displayString(ref, cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: This could be changed later, in addToToc, if we are using
|
// Note: This could also be changed later, in addToToc, if we are using
|
||||||
// fomatted references in the work area.
|
// fomatted references in the work area.
|
||||||
screen_label_ = label;
|
screen_label_ = label;
|
||||||
// This also can be overwritten in addToToc. (We can't do it now
|
// This also can be overwritten in addToToc. (We can't do it now
|
||||||
@ -572,13 +566,16 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Code for display of formatted references
|
// Code for display of formatted references
|
||||||
bool const use_formatted_ref = buffer().params().use_formatted_ref;
|
string const & cmd = getCmdName();
|
||||||
if (use_formatted_ref) {
|
if (cmd != "pageref" && cmd != "vpageref" &&
|
||||||
string const & cmd = getCmdName();
|
cmd != "vref" && cmd != "labelonly")
|
||||||
|
{
|
||||||
|
bool const use_formatted_ref = buffer().params().use_formatted_ref;
|
||||||
|
// We will put the value of the reference either into the tooltip
|
||||||
|
// or the screen label, depending.
|
||||||
|
docstring & target = use_formatted_ref ? screen_label_ : tooltip_;
|
||||||
docstring const & ref = getParam("reference");
|
docstring const & ref = getParam("reference");
|
||||||
if (cmd != "pageref" && cmd != "vpageref" && cmd != "vref" &&
|
target = displayString(ref, cmd);
|
||||||
cmd != "labelonly")
|
|
||||||
screen_label_ = displayString(ref, cmd);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user