]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.cpp
Don't add localswitch if no language changes
[lyx.git] / src / insets / InsetText.cpp
index 8228fd247d48dd44a7edcfd250c48a472b4b638f..930ea1475c6405954d23623c2a8e322223b6eb15 100644 (file)
@@ -220,11 +220,19 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
        int const h = tm.height() + 2 * TEXT_TO_INSET_OFFSET;
        int const xframe = x + TEXT_TO_INSET_OFFSET / 2;
        bool change_drawn = false;
-       if (drawFrame_ || pi.full_repaint) {
-               if (pi.full_repaint)
+       if (pi.full_repaint)
                        pi.pain.fillRectangle(xframe, yframe, w, h,
                                pi.backgroundColor(this));
 
+       {
+               Changer dummy = make_change(pi.background_color,
+                                           pi.backgroundColor(this, false));
+               // The change tracking cue must not be inherited
+               Changer dummy2 = make_change(pi.change_, Change());
+               tm.draw(pi, x + TEXT_TO_INSET_OFFSET, y);
+       }
+
+       if (drawFrame_) {
                // Change color of the frame in tracked changes, like for tabulars.
                // Only do so if the color is not custom. But do so even if RowPainter
                // handles the strike-through already.
@@ -242,16 +250,9 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
                        change_drawn = true;
                } else
                        c = frameColor();
-               if (drawFrame_)
-                       pi.pain.rectangle(xframe, yframe, w, h, c);
-       }
-       {
-               Changer dummy = make_change(pi.background_color,
-                                           pi.backgroundColor(this, false));
-               // The change tracking cue must not be inherited
-               Changer dummy2 = make_change(pi.change_, Change());
-               tm.draw(pi, x + TEXT_TO_INSET_OFFSET, y);
+               pi.pain.rectangle(xframe, yframe, w, h, c);
        }
+
        if (canPaintChange(*pi.base.bv) && (!change_drawn || pi.change_.deleted()))
                // Do not draw the change tracking cue if already done by RowPainter and
                // do not draw the cue for INSERTED if the information is already in the
@@ -448,7 +449,7 @@ void InsetText::latex(otexstream & os, OutputParams const & runparams) const
 {
        // This implements the standard way of handling the LaTeX
        // output of a text inset, either a command or an
-       // environment. Standard collapsable insets should not
+       // environment. Standard collapsible insets should not
        // redefine this, non-standard ones may call this.
        InsetLayout const & il = getLayout();
        if (il.forceOwnlines())
@@ -870,13 +871,15 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active,
                        addtotoc_stack.push({pit, end});
                }
 
-               // if we find an optarg, we'll save it for use later.
+               // If we find an InsetArgument that is supposed to provide the TOC caption,
+               // we'll save it for use later.
                InsetArgument const * arginset = nullptr;
                for (auto const & table : par.insetList()) {
                        dit.pos() = table.pos;
                        table.inset->addToToc(dit, doing_output, utype, backend);
                        if (InsetArgument const * x = table.inset->asInsetArgument())
-                               arginset = x;
+                               if (x->isTocCaption())
+                                       arginset = x;
                }
 
                // End custom AddToToc in paragraph layouts
@@ -1053,7 +1056,11 @@ docstring InsetText::toolTipText(docstring prefix, size_t const len) const
        for (; it != end; ++it) {
                if (it != beg)
                        oss << '\n';
+               if ((*it).isRTL(buffer().params()))
+                       oss << "<div dir=\"rtl\">";
                writePlaintextParagraph(buffer(), *it, oss, rp, ref_printed, len);
+               if ((*it).isRTL(buffer().params()))
+                       oss << "</div>";
                if (oss.tellp() >= 0 && size_t(oss.tellp()) > len)
                        break;
        }