]> git.lyx.org Git - features.git/blobdiff - src/Row.cpp
Allow toggling of Zoom elements without buffer
[features.git] / src / Row.cpp
index 4b9836edff3a19bc6d55f88ec8eb128e2f3635f4..6d6d31919418eca951d2d9e534691cfb35efe685 100644 (file)
@@ -162,6 +162,12 @@ bool Row::Element::splitAt(int const width, int next_width, bool force,
        bool first = true;
        docstring::size_type i = 0;
        for (FontMetrics::Break const & brk : breaks) {
+               /* For some reason breakString can decide to break before the
+                * first character (normally we use a 0-width nbsp to prevent
+                * that). Skip leading empty elements, they are never wanted.
+                */
+               if (first && brk.len == 0 && breaks.size() > 1)
+                       continue;
                Element e(STRING, pos + i, font, change);
                e.str = str.substr(i, brk.len);
                e.endpos = e.pos + brk.len;
@@ -579,6 +585,7 @@ Row::Elements Row::shortenIfNeeded(int const w, int const next_width)
                         */
                        if (wid_brk + cit_brk->dim.wid < w
                            && dim_.wid - (wid_brk + brk.dim.wid) >= next_width) {
+                               tail.clear();
                                break;
                        }
                        end_ = brk.endpos;
@@ -612,7 +619,6 @@ Row::Elements Row::shortenIfNeeded(int const w, int const next_width)
         * splitting this time.
         */
        if (cit->splitAt(w - wid, next_width, true, tail)) {
-               LYXERR0(*cit);
                end_ = cit->endpos;
                dim_.wid = wid + cit->dim.wid;
                // If there are other elements, they should be removed.