diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 28f0eafe7b..194ccb8eca 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -288,11 +288,7 @@ docstring InsetIndex::toolTip(BufferView const &, int, int) const tip += ")"; } tip += ": "; - OutputParams rp(&buffer().params().encoding()); - odocstringstream ods; - InsetText::plaintext(ods, rp); - tip += ods.str(); - return wrapParas(tip); + return InsetText::toolTipText(tip); } diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp index 8a6d2e68db..a3c5735998 100644 --- a/src/insets/InsetPhantom.cpp +++ b/src/insets/InsetPhantom.cpp @@ -299,13 +299,10 @@ bool InsetPhantom::getStatus(Cursor & cur, FuncRequest const & cmd, docstring InsetPhantom::toolTip(BufferView const &, int, int) const { - OutputParams rp(&buffer().params().encoding()); - odocstringstream ods; - InsetCollapsable::plaintext(ods, rp); - docstring content_tip = support::wrapParas(ods.str()); + docstring const tip = InsetText::toolTipText(); docstring res = phantomtranslator_loc().find(params_.type); - if (!content_tip.empty()) - res += from_ascii(": ") + "\n" + content_tip; + if (!tip.empty()) + res += from_ascii(": ") + "\n" + tip; return res; } diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 0a53c7bd06..a80c96eecc 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -820,11 +820,12 @@ docstring InsetText::contextMenu(BufferView const &, int, int) const } -docstring InsetText::toolTipText() const +docstring InsetText::toolTipText(docstring prefix) const { static unsigned int max_length = 400; // five 80 column lines OutputParams rp(&buffer().params().encoding()); odocstringstream oss; + oss << prefix; ParagraphList::const_iterator beg = paragraphs().begin(); ParagraphList::const_iterator end = paragraphs().end(); diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h index 5743be2f51..35904398a8 100644 --- a/src/insets/InsetText.h +++ b/src/insets/InsetText.h @@ -191,7 +191,9 @@ public: /// void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const; /// returns the text to be used as tooltip - docstring toolTipText() const; + /// \param prefix: a string that will preced the tooltip, + /// e.g., "Index: ". + docstring toolTipText(docstring prefix = from_ascii("")) const; /// virtual docstring contextMenu(BufferView const & bv, int x, int y) const;