]> git.lyx.org Git - lyx.git/commitdiff
Fix bug with display of reference tooltips.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Tue, 6 Aug 2024 15:31:35 +0000 (11:31 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Tue, 6 Aug 2024 15:35:20 +0000 (11:35 -0400)
Previously, the tooltip was assigned during updateBuffer. But then
we could not determine the value for forward references.

(cherry picked from commit b494286a9c271b1f39d6248d977d2ef14a71f64c)

src/insets/InsetRef.cpp
status.24x

index 0fd622b68933136bf5d200a14621e780ee6ca07f..c0dab054dc2399b180f420ab7b9efcf6ae24622e 100644 (file)
@@ -527,21 +527,15 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType, bool const /*del
                label += "||";
                label += getParam("name");
        }
-
-       bool const use_formatted_ref = buffer().params().use_formatted_ref;
-       unsigned int const maxLabelChars = 24;
+       
+       // The tooltip will be over-written later, in addToToc, if need be.
+       tooltip_ = label;
        toc_string_ = label;
-       // Show label in tooltip when formatted references are shown in the work
-       // area or it is too long
-       if (use_formatted_ref || label.size() > maxLabelChars) {
-               tooltip_ = label;
-               support::truncateWithEllipsis(label, maxLabelChars);
-       } else {
-               // put cross-reference value into tooltip
-               tooltip_ = displayString(ref, cmd);
-       }
+       
+       unsigned int const maxLabelChars = 24;
+       support::truncateWithEllipsis(label, maxLabelChars);
 
-       // 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.
        screen_label_ = label;
        // This also can be overwritten in addToToc. (We can't do it now
@@ -571,14 +565,17 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
                        toc2->push_back(TocItem(cpit, 0, screenLabel(), output_active));
                }
 
-               // Code for display of formatted references
-               bool const use_formatted_ref = buffer().params().use_formatted_ref;
-               docstring & target = use_formatted_ref ? screen_label_ : tooltip_;
                string const & cmd = getCmdName();
-               docstring const & ref = getParam("reference");
-               if (cmd != "pageref" && cmd != "vpageref" && cmd != "vref" &&
-                               cmd != "labelonly")
-                       target = displayString(ref, cmd);
+               if (cmd != "pageref" && cmd != "vpageref" &&
+                       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");
+                               target = displayString(ref, cmd);
+               }
                return;
        }
        // It seems that this reference does not point to any valid label.
index 57557afbee6d6b516b6f26406044dcd94139dfeb..8e80a7437f35f8273201d08ccc497b02afbc5f10 100644 (file)
@@ -86,6 +86,8 @@ What's new
 - Restore old display of cross-references in the outliner. The change led to
   odd behavior on filtering.
 
+- Display values of cross-references in tooltips for forward references.
+
 
 * INTERNALS