]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph_funcs.cpp
Work-around for bug #6034: Applying preferences confuses window about its size.
[lyx.git] / src / paragraph_funcs.cpp
index 0459ed79117dcef4dbdddd46935e9b637735bd2e..dfc895d1f1285e2da7111f4c1230c617f0b9c6a4 100644 (file)
@@ -191,7 +191,7 @@ void mergeParagraph(BufferParams const & bparams,
        // the imaginary end-of-paragraph character (at par.size()) has to be
        // marked as unmodified. Otherwise, its change is adopted by the first
        // character of the next paragraph.
-       if (par.lookupChange(par.size()).type != Change::UNCHANGED) {
+       if (par.isChanged(par.size())) {
                LYXERR(Debug::CHANGES,
                   "merging par with inserted/deleted end-of-par character");
                par.setChange(par.size(), Change(Change::UNCHANGED));
@@ -256,6 +256,32 @@ bool isFirstInSequence(pit_type par_offset, ParagraphList const & pars)
 }
 
 
+void setLabelWidthStringToSequence(pit_type const par_offset,
+       ParagraphList & pars, docstring const & s)
+{
+       pit_type offset = par_offset;
+       // Find first of same layout in sequence
+       while (!isFirstInSequence(offset, pars)) {
+               offset = depthHook(offset, pars, pars[offset].getDepth());
+       }
+
+       // now apply label width string to every par
+       // in sequence
+       pit_type const end = pars.size();
+       depth_type const depth = pars[offset].getDepth();
+       Layout const & layout = pars[offset].layout();
+       for (pit_type pit = offset; pit != end; ++pit) {
+               while (pars[pit].getDepth() > depth)
+                       ++pit;
+               if (pars[pit].getDepth() < depth)
+                       return;
+               if (pars[pit].layout() != layout)
+                       return;
+               pars[pit].setLabelWidthString(s);
+       }
+}
+
+
 int getEndLabel(pit_type p, ParagraphList const & pars)
 {
        pit_type pit = p;
@@ -312,7 +338,7 @@ bool isFullyDeleted(ParagraphList const & pars)
        // check all paragraphs
        for (pit_type pit = 0; pit < pars_size; ++pit) {
                if (!pars[pit].empty())   // prevent assertion failure
-                       if (!pars[pit].isFullyDeleted(0, pars[pit].size()))
+                       if (!pars[pit].isDeleted(0, pars[pit].size()))
                                return false;
        }
        return true;
@@ -327,7 +353,7 @@ void acceptChanges(ParagraphList & pars, BufferParams const & bparams)
        // (do not consider end-of-par)
        for (pit_type pit = 0; pit < pars_size; ++pit) {
                if (!pars[pit].empty())   // prevent assertion failure
-                       pars[pit].acceptChanges(bparams, 0, pars[pit].size());
+                       pars[pit].acceptChanges(0, pars[pit].size());
        }
 
        // next, accept imaginary end-of-par characters