John Levon <[EMAIL PROTECTED]> writes:
| On Thu, Sep 04, 2003 at 04:00:29PM +0200, Lars Gullik Bj?nnes wrote:
>
>> Well, I have a patch that just fixes this...
>
| Then you are just teasing me ! So cruel !
here is the patch.
This patch also removes lastPrintablePos and just uses lastPos instead
(that was what the code already did.)
(and some ugly code is there since I am trying to see if it possible
to get rid of lastPos)
Please try it out.
Index: src/lyxrow_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow_funcs.C,v
retrieving revision 1.13
diff -u -p -r1.13 lyxrow_funcs.C
--- src/lyxrow_funcs.C 26 Aug 2003 10:33:55 -0000 1.13
+++ src/lyxrow_funcs.C 4 Sep 2003 14:46:06 -0000
@@ -44,7 +44,7 @@ bool isParEnd(Paragraph const & par, Row
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,
}
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: src/lyxrow_funcs.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrow_funcs.h,v
retrieving revision 1.6
diff -u -p -r1.6 lyxrow_funcs.h
--- src/lyxrow_funcs.h 23 Aug 2003 00:16:14 -0000 1.6
+++ src/lyxrow_funcs.h 4 Sep 2003 14:46:06 -0000
@@ -22,8 +22,6 @@ bool isParEnd(Paragraph const & par, Row
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: src/rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.60
diff -u -p -r1.60 rowpainter.C
--- src/rowpainter.C 28 Aug 2003 07:41:17 -0000 1.60
+++ src/rowpainter.C 4 Sep 2003 14:46:06 -0000
@@ -257,7 +257,7 @@ void RowPainter::paintArabicComposeChar(
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: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.435
diff -u -p -r1.435 text.C
--- src/text.C 4 Sep 2003 03:53:57 -0000 1.435
+++ src/text.C 4 Sep 2003 14:46:06 -0000
@@ -287,7 +287,7 @@ void LyXText::computeBidiTables(Paragrap
}
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::iterato
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: src/text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.454
diff -u -p -r1.454 text2.C
--- src/text2.C 4 Sep 2003 03:53:59 -0000 1.454
+++ src/text2.C 4 Sep 2003 14:46:06 -0000
@@ -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,
// 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(Paragra
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();
--
Lgb