]> git.lyx.org Git - lyx.git/blobdiff - src/text.C
honor nextnoindent
[lyx.git] / src / text.C
index 4603d9a2f9fc051e17500919bf1d5b9651541dfd..5c54cc342bd0b1f5611f04566b6d72d180835172 100644 (file)
@@ -474,8 +474,8 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
        l_margin += font_metrics::signedWidth(tclass.leftmargin(), tclass.defaultfont());
 
        if (par.getDepth() != 0) {
-       // find the next level paragraph
-       pit_type newpar = outerHook(pit, pars_);
+               // find the next level paragraph
+               pit_type newpar = outerHook(pit, pars_);
                if (newpar != pit_type(pars_.size())) {
                        if (pars_[newpar].layout()->isEnvironment()) {
                                l_margin = leftMargin(newpar);
@@ -489,6 +489,13 @@ int LyXText::leftMargin(pit_type const pit, pos_type const pos) const
                }
        }
 
+       // This happens after sections in standard classes. The 1.3.x
+       // code compared depths too, but it does not seem necessary
+       // (JMarc)
+       if (par.layout() == tclass.defaultLayout()
+           && pit > 0 && pars_[pit - 1].layout()->nextnoindent)
+               parindent.erase();
+
        LyXFont const labelfont = getLabelFont(par);
        switch (layout->margintype) {
        case MARGIN_DYNAMIC:
@@ -1187,8 +1194,7 @@ void LyXText::insertChar(LCursor & cur, char c)
 
        current_font = rawtmpfont;
        real_current_font = realtmpfont;
-       //setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
-       setCursor(cur, cur.pit(), cur.pos() + 1, false, true);
+       setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
        charInserted();
 }
 
@@ -1717,6 +1723,20 @@ bool LyXText::redoParagraph(pit_type const pit)
                z = row.endpos();
        } while (z < par.size());
 
+       // Make sure that if a par ends in newline, there is one more row
+       // under it
+       // FIXME this is a dirty trick. Now the _same_ position in the
+       // paragraph occurs in _two_ different rows, and has two different
+       // display positions, leading to weird behaviour when moving up/down.
+       if (z > 0 && par.isNewline(z - 1)) {
+               Row row(z - 1);
+               row.endpos(z - 1);
+               setRowWidth(pit, row);
+               setHeightOfRow(pit, row);
+               par.rows().push_back(row);
+               dim.des += row.height();
+       }
+           
        dim.asc += par.rows()[0].ascent();
        dim.des -= par.rows()[0].ascent();
 
@@ -1776,12 +1796,8 @@ void LyXText::drawSelection(PainterInfo & pi, int x , int) const
 
        lyxerr << "draw selection at " << x << endl;
 
-       // is there a better way of getting these two iterators?
-       DocIterator beg = cur;
-       DocIterator end = cur;
-
-       beg.top() = cur.selBegin();
-       end.top() = cur.selEnd();
+       DocIterator beg = cur.selectionBegin();
+       DocIterator end = cur.selectionEnd();
 
        // the selection doesn't touch the visible screen
        if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_BELOW
@@ -1849,12 +1865,8 @@ void LyXText::drawSelection(PainterInfo & pi, int x, int) const
                 << "draw selection at " << x
                 << endl;
 
-       // is there a better way of getting these two iterators?
-       DocIterator beg = cur;
-       DocIterator end = cur;
-
-       beg.top() = cur.selBegin();
-       end.top() = cur.selEnd();
+       DocIterator beg = cur.selectionBegin();
+       DocIterator end = cur.selectionEnd();
 
        // the selection doesn't touch the visible screen
        if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_BELOW