]> git.lyx.org Git - lyx.git/commitdiff
fix cursorEnd, remove lastPrintablePos
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 4 Sep 2003 15:21:34 +0000 (15:21 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 4 Sep 2003 15:21:34 +0000 (15:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7664 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/lyxrow_funcs.C
src/lyxrow_funcs.h
src/rowpainter.C
src/text.C
src/text2.C

index 741491691f6a080fb4b1dce22f184d93ddb61ecc..d09477a0212f255903644f8cfc4c4e17a001a547 100644 (file)
@@ -1,3 +1,21 @@
+2003-09-04  Lars Gullik Bjønnes  <larsbj@lyx.org>
+
+       * text2.C (cursorEnd): simplify
+       (setCursor): adjust
+       (getColumnNearX): adjust
+
+       * text.C (computeBidiTables): adjust
+       (fill): adjust
+
+       * rowpainter.C (paintChars): adjust
+       (paintSelection): adjust
+       (paintChangeBar): adjust
+       (paintText): adjust
+
+       * lyxrow_funcs.C (lastPrintablePos): remove, all users now call
+       lastPos instead.
+       (numberOfSeparators): adjust
+
 2003-09-03  Martin Vermeer  <martin.vermeer@hut.fi>
 
        * LyXAction.C:
index 9dacc2aa219f9d206caac418c910fc0c10eb0e4d..54cbdc3251cbbb74bd041a2ff883e7cf14a6ad07 100644 (file)
@@ -44,7 +44,7 @@ bool isParEnd(Paragraph const & par, RowList::iterator rit)
        return boost::next(rit) == par.rows.end();
 }
 
-
+#if 1
 pos_type lastPos(Paragraph const & par, RowList::iterator rit)
 {
        if (par.empty())
@@ -62,23 +62,17 @@ pos_type lastPos(Paragraph const & par, RowList::iterator rit)
        }
        return boost::next(rit)->pos() - 1;
 }
-
-
-pos_type lastPrintablePos(Paragraph const & par, RowList::iterator rit)
+#else
+pos_type lastPos(Paragraph const &, RowList::iterator rit)
 {
-       pos_type const last = lastPos(par, rit);
-
-       // if this row is an end of par, just act like lastPos()
-       if (isParEnd(par, rit))
-               return last;
-
-       return last;
+       return rit->end() - 1;
 }
+#endif
 
 
 int numberOfSeparators(Paragraph const & par, RowList::iterator rit)
 {
-       pos_type const last = lastPrintablePos(par, rit);
+       pos_type const last = lastPos(par, rit);
        int n = 0;
        pos_type p = max(rit->pos(), par.beginningOfBody());
        for ( ; p < last; ++p)
index 046e3c9d7de124cb562fe250eddd06767f24a9ae..a3f012054cfcfba6f8cce8d8f4f29ecc41aa52cc 100644 (file)
@@ -22,8 +22,6 @@ bool isParEnd(Paragraph const & par, RowList::iterator rit);
 
 lyx::pos_type lastPos(Paragraph const & par, RowList::iterator rit);
 
-lyx::pos_type lastPrintablePos(Paragraph const & par, RowList::iterator rit);
-
 int numberOfSeparators(Paragraph const & par, RowList::iterator rit);
 
 int numberOfHfills(Paragraph const & par, RowList::iterator rit);
index a59e8385bbda8be267fc7b6cb4aaada930b43ce6..7801f9115b04f2facb8c7038d1384e4a3d5fa212 100644 (file)
@@ -257,7 +257,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos)
 void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
 {
        pos_type pos = text_.vis2log(vpos);
-       pos_type const last = lastPrintablePos(*pit_, row_);
+       pos_type const last = lastPos(*pit_, row_);
        LyXFont orig_font = getFont(pos);
 
        // first character
@@ -434,7 +434,7 @@ void RowPainter::paintSelection()
                        int(x_), row_->height(), LColor::selection);
 
        pos_type const body_pos = pit_->beginningOfBody();
-       pos_type const last = lastPrintablePos(*pit_, row_);
+       pos_type const last = lastPos(*pit_, row_);
        double tmpx = x_;
 
        for (pos_type vpos = row_->pos(); vpos <= last; ++vpos)  {
@@ -486,7 +486,7 @@ void RowPainter::paintSelection()
 void RowPainter::paintChangeBar()
 {
        pos_type const start = row_->pos();
-       pos_type const end = lastPrintablePos(*pit_, row_);
+       pos_type const end = lastPos(*pit_, row_);
 
        if (!pit_->isChanged(start, end))
                return;
@@ -896,7 +896,7 @@ void RowPainter::paintLast()
 
 void RowPainter::paintText()
 {
-       pos_type const last = lastPrintablePos(*pit_, row_);
+       pos_type const last = lastPos(*pit_, row_);
        pos_type body_pos = pit_->beginningOfBody();
        if (body_pos > 0 &&
                (body_pos - 1 > last || !pit_->isLineSeparator(body_pos - 1))) {
index 4cc0cee5941e428d45a4c5c4cb9a55a14ed6ff97..26460846e810f96c4ec7fb0652c220b2e7ddaaff 100644 (file)
@@ -287,7 +287,7 @@ void LyXText::computeBidiTables(ParagraphList::iterator pit,
        }
 
        bidi_start = row->pos();
-       bidi_end = lastPrintablePos(*pit, row);
+       bidi_end = lastPos(*pit, row);
 
        if (bidi_start > bidi_end) {
                bidi_start = -1;
@@ -779,7 +779,7 @@ int LyXText::fill(ParagraphList::iterator pit,
 
        int w;
        // get the pure distance
-       pos_type const last = lastPrintablePos(*pit, row);
+       pos_type const last = lastPos(*pit, row);
 
        LyXLayout_ptr const & layout = pit->layout();
 
index 8158ebaa6c6f89d0b3c21069a10b3cf4b9f75e60..b1318017c18cfb9c72eaa70c5dbd81876e16165c 100644 (file)
@@ -672,16 +672,7 @@ void LyXText::cursorHome()
 
 void LyXText::cursorEnd()
 {
-       if (cursor.par()->empty())
-               return;
-
-       RowList::iterator rit = cursorRow();
-       ParagraphList::iterator pit = cursor.par();
-       pos_type pos = lastPos(*pit, rit);
-       /* cursor should be before a hard newline only */
-       if (!pit->isNewline(pos))
-               ++pos;
-       setCursor(pit, pos);
+       setCursor(cursor.par(), cursorRow()->end() - 1);
 }
 
 
@@ -1358,7 +1349,7 @@ void LyXText::setCursor(LyXCursor & cur, ParagraphList::iterator pit,
        // y is now the cursor baseline
        cur.y(y);
 
-       pos_type last = lastPrintablePos(*pit, row);
+       pos_type last = lastPos(*pit, row);
 
        // None of these should happen, but we're scaredy-cats
        if (pos > pit->size()) {
@@ -1497,7 +1488,7 @@ pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
        double fill_label_hfill = rit->fill_label_hfill();
 
        pos_type vc = rit->pos();
-       pos_type last = lastPrintablePos(*pit, rit);
+       pos_type last = lastPos(*pit, rit);
        pos_type c = 0;
        LyXLayout_ptr const & layout = pit->layout();